Package org.ow2.authzforce.core.pdp.api
Interface UpdatableMap<K,V>
-
- Type Parameters:
K
- type of keys in this mapV
- type of mapped values
public interface UpdatableMap<K,V>
Updatable Map; "updatable" means elements can only be put to the Map (no removal, no clear)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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 MapV
get(K key)
Returns the value to which the specified key is mapped, ornull
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.
-
-
-
Method Detail
-
put
V put(K key, V value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key- Returns:
- the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)
-
putIfAbsent
V putIfAbsent(K key, V value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key- Returns:
- the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)
-
putAll
void putAll(Map<? extends K,? extends V> m)
Copies all of the mappings from the specified map to this map (optional operation). The effect of this call is equivalent to that of callingput(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.- Parameters:
m
- mappings to be stored in this map- Throws:
UnsupportedOperationException
- 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 map
-
containsKey
boolean containsKey(K key)
Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)- Parameters:
key
- key whose presence in this map is to be tested- Returns:
- true if this map contains a mapping for the specified key
- Throws:
NullPointerException
- if the specified key is null and this map does not permit null keys ( optional)
-
copy
com.google.common.collect.ImmutableMap<K,V> copy()
Creates an immutable Map copy with all the elements currently in this Map- Returns:
- immutable copy of the Map
-
get
V get(K key)
Returns the value to which the specified key is mapped, ornull
if this map contains no mapping for the key.More formally, if this map contains a mapping from a key
k
to a valuev
such that(key==null ? k==null : key.equals(k))
, then this method returnsv
; otherwise it returnsnull
. (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 tonull
. ThecontainsKey
operation may be used to distinguish these two cases.- Parameters:
key
- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
null
if this map contains no mapping for the key - Throws:
NullPointerException
- if the specified key is null and this map does not permit null keys ( optional)
-
-