K
- type of keys in this mapV
- type of mapped valuespublic interface UpdatableMap<K,V>
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(K key)
Returns true if this map contains a mapping for the specified key.
|
com.google.common.collect.ImmutableMap<K,V> |
copy()
Creates an immutable Map copy with all the elements currently in this Map
|
V |
get(K key)
Returns the value to which the specified key is mapped, or
null if this map contains no mapping for the key. |
V |
put(K key,
V value)
Associates the specified value with the specified key in this map.
|
void |
putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to this map (optional operation).
|
V |
putIfAbsent(K key,
V value)
Associates the specified value with the specified key in this map.
|
V put(K key, V value)
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keyV putIfAbsent(K key, V value)
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keyvoid putAll(Map<? extends K,? extends V> m)
put(k, v)
on this map
once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in
progress.m
- mappings to be stored in this mapUnsupportedOperationException
- if the putAll operation is not supported by this mapClassCastException
- if the class of a key or value in the specified map prevents it from being stored in this mapNullPointerException
- if the specified map is null, or if this map does not permit null keys or values, and the specified map contains null keys or valuesIllegalArgumentException
- if some property of a key or value in the specified map prevents it from being stored in this mapboolean containsKey(K key)
key
- key whose presence in this map is to be testedNullPointerException
- if the specified key is null and this map does not permit null keys ( optional)com.google.common.collect.ImmutableMap<K,V> copy()
V get(K key)
null
if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key k
to a value v
such that (key==null ? k==null :
key.equals(k))
, then this method returns v
; otherwise it returns null
. (There can be at most one such mapping.)
If this map permits null values, then a return value of null
does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map
explicitly maps the key to null
. The containsKey
operation may be used to distinguish these two cases.
key
- the key whose associated value is to be returnednull
if this map contains no mapping for the keyNullPointerException
- if the specified key is null and this map does not permit null keys ( optional)Copyright © 2012–2020. All rights reserved.