K - type of keys in this mapV - type of mapped valuespublic interface OptMap<K,V>
null value is accepted nor returned and (2) the methods that
verify containment accept only objects of type K or
V.| 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.
|
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.
|
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.
|
Collection<V> |
values()
Returns the collection of values.
|
int size()
boolean isEmpty()
true if and only if this map is empty.true if and only if this map is emptyboolean containsKey(K key)
true if and only if this map contains a mapping for
the given key. This method replaces Map.containsKey(Object).key - keytrue if and only if this map contains a mapping for
the given keyNullPointerException - if a null value is givenboolean containsValue(V value)
true if and only if this map associates one or more
keys to the given value. This method replaces
Map.containsValue(Object).value - valuetrue if and only if this map associates one or more
keys to the given valueNullPointerException - if a null value is givenOptional<V> get(K key)
Map.get(Object).key - keyOptional<V> put(K key, V value)
put(K, V).key - keyvalue - valueNullPointerException - if a null value is givenOptional<V> remove(K key)
Map.remove(Object).key - keyNullPointerException - if a null value is givenvoid clear()
void putAll(Map<? extends K,? extends V> m)
m - map containing associationsCollection<V> values()
Set<Map.Entry<K,V>> entrySet()
Copyright © 2017 Chair of Automata Theory - TU Dresden. All rights reserved.