public class TwoLevelMap<K1,K2,V>
extends java.lang.Object
implements java.util.Map<K1,java.util.Map<K2,V>>
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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() |
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.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 testedpublic boolean containsKey(java.lang.Object key1)
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 componentpublic boolean containsValue(java.lang.Object value)
@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 componentput(Pair, Object)
public boolean isEmpty()
public java.util.Set<K1> keySet()
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.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 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 componentpublic int size()
public java.lang.String toString()
toString
in class java.lang.Object
@enterprise 9.0.33982 Copyright © 2001-2023 Groiss Informatics GmbH. All Rights Reserved.