|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.myjavatools.lib.foundation.AbstractMap2<X,Y,V>
public abstract class AbstractMap2<X,Y,V>
AbstractMap2 is a partial implementation of two-parameter map.
Copyright: This is public domain; The right of people to use, distribute, copy or improve the contents of the following may not be restricted.
Company: My Java Tools
Nested Class Summary | |
---|---|
static class |
AbstractMap2.Entry<X,Y,V>
An entry of a two-parameter map. |
Constructor Summary | |
---|---|
AbstractMap2()
Default constructor |
Method Summary | |
---|---|
void |
clear()
Removes all mappings from this map. This implementation calls entrySet().clear(). |
boolean |
containsKeyPair(java.lang.Object key1,
java.lang.Object key2)
Returns true if this map contains a mapping for the
specified key pair.
This implementation iterates over entrySet() searching for an
entry with the specified keys. |
boolean |
containsValue(java.lang.Object value)
|
java.util.Map<Y,V> |
curry1(X key1)
Currying by first argument. This implementation builds the map on every call. |
java.util.Map<X,V> |
curry2(Y key2)
Currying by second argument. This implementation builds the map on every call. |
abstract java.util.Set<Map2.Entry<X,Y,V>> |
entrySet()
Returns a set view of the mappings contained in this map. |
protected static boolean |
equal(java.lang.Object o1,
java.lang.Object o2)
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this map for equality. |
V |
get(X key1,
Y key2)
Returns the value to which this map maps the specified key pair, and null if the map contains no mapping for these keys.
This implementation iterates over entrySet() searching for an
entry with the specified pair of keys. |
int |
hashCode()
|
boolean |
isEmpty()
|
abstract java.util.Set<X> |
keySet1()
A Map2 has two sets of keys, first component and second component. |
abstract java.util.Set<Y> |
keySet2()
A Map2 has two sets of keys, first component and second component. |
V |
put(X key1,
Y key2,
V value)
Associates the specified value with the specified key pair. This implementation always throws an UnsupportedOperationException . |
void |
putAll(Map2<? extends X,? extends Y,? extends V> source)
Copies all of the mappings from the specified map to this map. This implementation iterates over the specified map's entrySet() collection, and calls this map's put
operation once for each entry returned by the iteration. |
V |
remove(X key1,
Y key2)
Removes the mapping for this key pair from this map if it is present. This implementation iterates over entrySet() searching for an
entry with the specified pair of keys. |
int |
size()
|
java.lang.String |
toString()
|
java.util.Collection<V> |
values()
Returns a collection view of the values contained in this map. This implementation returns a collection and is based on the map's entrySet. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractMap2()
Method Detail |
---|
protected static boolean equal(java.lang.Object o1, java.lang.Object o2)
public int size()
size
in interface Map2<X,Y,V>
public boolean isEmpty()
isEmpty
in interface Map2<X,Y,V>
true
if this map contains no key-value mappings.public boolean containsValue(java.lang.Object value)
public boolean containsKeyPair(java.lang.Object key1, java.lang.Object key2)
true
if this map contains a mapping for the
specified key pair.
This implementation iterates over entrySet()
searching for an
entry with the specified keys. If such an entry is found,
true
is returned. If the iteration terminates without
finding such an entry, false
is returned. Note that this
implementation requires linear time in the size of the map; many
implementations will override this method.
containsKeyPair
in interface Map2<X,Y,V>
key1
- first keykey2
- second key
true
if this map contains a mapping for the specified
pair of keys.public V get(X key1, Y key2)
null
if the map contains no mapping for these keys.
This implementation iterates over entrySet()
searching for an
entry with the specified pair of keys. If such an entry is found,
the entry's value is returned. If the iteration terminates without
finding such an entry, null
is returned. Note that
this implementation requires linear time in the size of the map;
many implementations will override this method.
get
in interface Map2<X,Y,V>
key1
- first keykey2
- second key
#containsKeyPair(X,Y)
public V put(X key1, Y key2, V value)
UnsupportedOperationException
.
put
in interface Map2<X,Y,V>
key1
- first key.key2
- second key.value
- value to be associated with the specified key pair.
null
if there was no mapping for key.public V remove(X key1, Y key2)
Returns the value to which the map previously associated the keys, or
null if the map contained no mapping for this key pair.
This implementation iterates over entrySet()
searching for an
entry with the specified pair of keys. If such an entry is found,
its value is obtained with its getValue
operation,
the entry is removed from the collection of entries with the iterator's
remove operation, and the saved value is returned. If the
iteration terminates without finding such an entry, null
is
returned. Note that this implementation requires linear time in the
size of the map; many implementations will override this method.
remove
in interface Map2<X,Y,V>
key1
- first key.key2
- second key.
public void putAll(Map2<? extends X,? extends Y,? extends V> source)
entrySet()
collection, and calls this map's put
operation once for each entry returned by the iteration.
putAll
in interface Map2<X,Y,V>
public void clear()
clear
in interface Map2<X,Y,V>
public abstract java.util.Set<X> keySet1()
Map2
keySet1
in interface Map2<X,Y,V>
public abstract java.util.Set<Y> keySet2()
Map2
keySet2
in interface Map2<X,Y,V>
public java.util.Collection<V> values()
values
in interface Map2<X,Y,V>
public java.util.Map<Y,V> curry1(X key1)
curry1
in interface Map2<X,Y,V>
key1
- X
public java.util.Map<X,V> curry2(Y key2)
curry2
in interface Map2<X,Y,V>
key2
- X
public abstract java.util.Set<Map2.Entry<X,Y,V>> entrySet()
Map2.Entry
. The set is backed by the
map, so changes to the map are reflected in the set, and vice-versa.
entrySet
in interface Map2<X,Y,V>
public boolean equals(java.lang.Object o)
true
if the given object is also a map2 and the two maps
represent the same mappings.
equals
in class java.lang.Object
o
- object to be compared for equality with this map.
true
if the specified object is equal to this map.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |