|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.groiss.ds.TwoLevelMap<K1,K2,V>
public class TwoLevelMap<K1,K2,V>
HashMap based two-level Map. A value can be associated with a "key path" which is an ordered list of two keys. It can be also be determined if something has been associated with the first component of a key path irrespective of the concrete second component of the key path.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
TwoLevelMap()
Constructs an empty TwoLevelMap. |
|
TwoLevelMap(java.lang.String name)
Constructs an empty TwoLevelMap with the specified name. |
|
TwoLevelMap(java.lang.String name,
int initialCapacity)
Constructs an empty TwoLevelMap with the specified name and initial capacity. |
Method Summary | |
---|---|
void |
clear()
|
boolean |
containsKey(K1 key1,
K2 key2)
Returns true if this map contains a mapping for the specified key path. |
boolean |
containsKey(java.lang.Object key1)
Returns true if this map contains a mapping for the specified key path component. |
boolean |
containsKey(Pair<K1,K2> p)
Returns true if this map contains a mapping for the specified key path designated by the specified Pair |
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<K1,java.util.Map<K2,V>>> |
entrySet()
|
java.util.Set<K1> |
firstKeySet()
Deprecated. since 8.0; use keySet() |
V |
get(K1 key1,
K2 key2)
Returns the value to which the specified key path is mapped in this map, or null if the map contains no mapping for this key path. |
java.util.Map<K2,V> |
get(java.lang.Object key1)
Returns the Map of values to which the specified key path component is mapped in this map, or null if the map contains no mapping for this key path component. |
V |
get(Pair<K1,K2> p)
Returns the value to which the specified key path designated by the Pair is mapped in this map, or null if the map contains no mapping for this key path. |
boolean |
isEmpty()
|
java.util.Set<K1> |
keySet()
|
java.lang.Object |
put(K1 key1,
K2 key2,
V value)
Associates the specified value with the specified key path key1 / key2 in this map. |
java.util.Map<K2,V> |
put(K1 key,
java.util.Map<K2,V> value)
|
java.lang.Object |
put(Pair<K1,K2> p,
V value)
Associates the specified value with the key path designated by the Pair in this map. |
void |
putAll(java.util.Map<? extends K1,? extends java.util.Map<K2,V>> t)
|
java.util.Map<K2,V> |
remove(java.lang.Object key1)
Removes the mapping for this key path component from this map if present. |
V |
remove(Pair<?,?> p)
Removes the mapping for the key path designated by the specified Pair from this map if present. |
V |
removeByKeys(java.lang.Object key1,
java.lang.Object key2)
Removes the mapping for this key path from this map if present. |
int |
size()
Returns the number of first level key path mappings in this map. |
java.lang.String |
toString()
|
java.util.Collection<java.util.Map<K2,V>> |
values()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public TwoLevelMap()
public TwoLevelMap(java.lang.String name)
name
- the name of this map.public TwoLevelMap(java.lang.String name, int initialCapacity)
name
- the name of this map.initialCapacity
- the initial capacity.Method Detail |
---|
public void clear()
clear
in interface java.util.Map<K1,java.util.Map<K2,V>>
public boolean containsKey(K1 key1, K2 key2)
key1
- The first part of the key path whose presence in this map is to be testedkey2
- The second part of the key path whose presence in this map is to be tested
public boolean containsKey(java.lang.Object key1)
containsKey
in interface java.util.Map<K1,java.util.Map<K2,V>>
key1
- The first part of the key path whose presence in this map is to be tested
public boolean containsKey(Pair<K1,K2> p)
p
- the Pair designating the key path
p.first designated the first path component,
p.second designates the second path component
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K1,java.util.Map<K2,V>>
public java.util.Set<java.util.Map.Entry<K1,java.util.Map<K2,V>>> entrySet()
entrySet
in interface java.util.Map<K1,java.util.Map<K2,V>>
@Deprecated public java.util.Set<K1> firstKeySet()
keySet()
public V get(K1 key1, K2 key2)
key1
- the first component of the key path whose associated map is to be returned.key2
- the second component of the key path whose associated map is to be returned.
put(Object, Object, Object)
public java.util.Map<K2,V> get(java.lang.Object key1)
get
in interface java.util.Map<K1,java.util.Map<K2,V>>
key1
- the first component of the key path whose associated map is to be returned.
put(Object, Object, Object)
public V get(Pair<K1,K2> p)
p
- the Pair designating the key path
p.first designated the first path component,
p.second designates the second path component
put(Pair, Object)
public boolean isEmpty()
isEmpty
in interface java.util.Map<K1,java.util.Map<K2,V>>
public java.util.Set<K1> keySet()
keySet
in interface java.util.Map<K1,java.util.Map<K2,V>>
public java.lang.Object put(K1 key1, K2 key2, V value)
key1
- the first component of the key path with which the specified value is to be associated.key2
- the second component of the key path with which the specified value is to be associated.value
- value to be associated with the specified key path.
public java.util.Map<K2,V> put(K1 key, java.util.Map<K2,V> value)
put
in interface java.util.Map<K1,java.util.Map<K2,V>>
public java.lang.Object put(Pair<K1,K2> p, V value)
p
- the Pair designating the key path
p.first() designated the first path component,
p.second() designates the second path componentvalue
- value to be associated with the specified key path.
public void putAll(java.util.Map<? extends K1,? extends java.util.Map<K2,V>> t)
putAll
in interface java.util.Map<K1,java.util.Map<K2,V>>
public java.util.Map<K2,V> remove(java.lang.Object key1)
remove
in interface java.util.Map<K1,java.util.Map<K2,V>>
key1
- key path component whose mapping is to be removed from the map.
public V removeByKeys(java.lang.Object key1, java.lang.Object key2)
key1
- the first component of the key path whose mapping is to be removed from the map.key2
- the second component of the key path whose mapping is to be removed from the map.
remove
. Renamed because of clash with new method in Java 8.public V remove(Pair<?,?> p)
p
- the Pair designating the key path
p.first designated the first path component,
p.second designates the second path component
public int size()
size
in interface java.util.Map<K1,java.util.Map<K2,V>>
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Collection<java.util.Map<K2,V>> values()
values
in interface java.util.Map<K1,java.util.Map<K2,V>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |