K - type of keys in this mapV - type of mapped valuespublic class OptMapImpl<K,V> extends Object implements OptMap<K,V>
OptMap. This implementation
does not copy the map passed as an argument to create the instance, and it
uses the map itself instead. This means that the internal representation can
be modified externally, or it can be retrieved by using asMap().OptMap| Constructor and Description |
|---|
OptMapImpl()
Constructs a new map.
|
OptMapImpl(Map<K,V> map)
Constructs a new map using a specified
Map. |
OptMapImpl(OptMap<K,V> map)
Constructs a new map using another specified
OptMap. |
| Modifier and Type | Method and Description |
|---|---|
Map<K,V> |
asMap()
Returns this as a
Map. |
void |
clear()
Clears this map.
|
boolean |
containsKey(K key)
Returns
true if and only if this map contains a mapping for
the given key. |
boolean |
containsValue(V value)
Returns
true if and only if this map associates one or more
keys to the given value. |
Set<Map.Entry<K,V>> |
entrySet()
Returns a set of associations.
|
boolean |
equals(Object obj) |
Optional<V> |
get(K key)
Returns an optional containing the value associated to the given key, is
this association exists, or an empty optional otherwise.
|
int |
hashCode() |
boolean |
isEmpty()
Returns
true if and only if this map is empty. |
Set<K> |
keySet()
Returns the set of keys.
|
Optional<V> |
put(K key,
V value)
Associates the given value with the given key.
|
void |
putAll(Map<? extends K,? extends V> m)
Adds all the associations given in the specified map.
|
Optional<V> |
remove(K key)
Removes the mapping for the given key.
|
int |
size()
Returns the size of this map.
|
String |
toString() |
Collection<V> |
values()
Returns the collection of values.
|
public OptMapImpl()
HashMap.public OptMapImpl(Map<K,V> map)
Map.map - mappublic int size()
OptMappublic boolean isEmpty()
OptMaptrue if and only if this map is empty.public boolean containsKey(K key)
OptMaptrue if and only if this map contains a mapping for
the given key. This method replaces Map.containsKey(Object).containsKey in interface OptMap<K,V>key - keytrue if and only if this map contains a mapping for
the given keypublic boolean containsValue(V value)
OptMaptrue if and only if this map associates one or more
keys to the given value. This method replaces
Map.containsValue(Object).containsValue in interface OptMap<K,V>value - valuetrue if and only if this map associates one or more
keys to the given valuepublic Optional<V> get(K key)
OptMapMap.get(Object).public Optional<V> put(K key, V value)
OptMapput(K, V).public Optional<V> remove(K key)
OptMapMap.remove(Object).public void putAll(Map<? extends K,? extends V> m)
OptMappublic void clear()
OptMappublic Collection<V> values()
OptMappublic Set<Map.Entry<K,V>> entrySet()
OptMapCopyright © 2017 Chair of Automata Theory - TU Dresden. All rights reserved.