public class TwoLevelMap<K1,K2,V> extends Object implements Map<K1,Map<K2,V>>
Constructor and Description |
---|
TwoLevelMap()
Constructs an empty
TwoLevelMap . |
TwoLevelMap(String name)
Constructs an empty
TwoLevelMap with the specified name. |
TwoLevelMap(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(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(Object value) |
Set<Map.Entry<K1,Map<K2,V>>> |
entrySet() |
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. |
Map<K2,V> |
get(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() |
Set<K1> |
keySet() |
Object |
put(K1 key1,
K2 key2,
V value)
Associates the specified value with the specified key path key1 / key2 in this map.
|
Map<K2,V> |
put(K1 key,
Map<K2,V> value) |
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(Map<? extends K1,? extends Map<K2,V>> t) |
Map<K2,V> |
remove(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(Object key1,
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.
|
String |
toString() |
Collection<Map<K2,V>> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public TwoLevelMap()
TwoLevelMap
.public TwoLevelMap(String name)
TwoLevelMap
with the specified name.name
- the name of this map.public TwoLevelMap(String name, int initialCapacity)
TwoLevelMap
with the specified
name and initial capacity.name
- the name of this map.initialCapacity
- the initial capacity.public boolean containsKey(K1 key1, K2 key2)
true
if this map contains a mapping for the
specified key path.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 testedtrue
if this map contains a mapping for the specified
key path.public boolean containsKey(Object key1)
true
if this map contains a mapping for the
specified key path component.public boolean containsKey(Pair<K1,K2> p)
true
if this map contains a mapping for the
specified key path designated by the specified Pairp
- the Pair designating the key path
p.first designated the first path component,
p.second designates the second path componenttrue
if this map contains a mapping for the specified
key path.public boolean containsValue(Object value)
@Deprecated public Set<K1> firstKeySet()
keySet()
public V get(K1 key1, K2 key2)
null
if the map contains no mapping for this key path.
A return value of null
does not necessarily indicate
that the map contains no mapping for the key path ; it is also possible that
the map explicitly maps the key path to null
. The
containsKey
method may be used to distinguish these two cases.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.null
if the map contains no mapping for this key path.put(Object, Object, Object)
public Map<K2,V> get(Object key1)
null
if the map contains no mapping for this key path component.
A return value of null
does not necessarily indicate
that the map contains no mapping for the key path component; it is also possible that
the map explicitly maps the key path component to null
. The
containsKey
method may be used to distinguish these two cases.get
in interface Map<K1,Map<K2,V>>
key1
- the first component of the key path whose associated map is to be returned.null
if the map contains no mapping for this key path component.put(Object, Object, Object)
public V get(Pair<K1,K2> p)
null
if the map contains no mapping for this key path.
A return value of null
does not necessarily indicate
that the map contains no mapping for the key path ; it is also possible that
the map explicitly maps the key path to null
. The
containsKey
method may be used to distinguish these two cases.p
- the Pair designating the key path
p.first designated the first path component,
p.second designates the second path componentnull
if the map contains no mapping for this key path.put(Pair, Object)
public 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.null
if there was no mapping for key path. A null
return can
also indicate that the HashMap previously associated
null
with the specified key.public 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.null
if there was no mapping for key path. A null
return can
also indicate that the HashMap previously associated
null
with the specified key.public Map<K2,V> remove(Object key1)
remove
in interface Map<K1,Map<K2,V>>
key1
- key path component whose mapping is to be removed from the map.null
if there was no mapping for key1. A null
return can
also indicate that the map previously associated null
with the specified key.public V removeByKeys(Object key1, 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.null
if there was no mapping for the key path. A null
return can
also indicate that the value previously associated null
with the specified key path.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 componentnull
if there was no mapping for the key path. A null
return can
also indicate that the value previously associated null
with the specified key path.public int size()
@enterprise 10.0.38589 Copyright © 2001-2024 Groiss Informatics GmbH. All Rights Reserved.