K
- the key type of content of this MapV
- the value type of content of this Mappublic interface ImmutableMap<K,V> extends Serializable
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(Object key)
Returns true if this map contains a mapping for the specified key.
|
boolean |
containsValue(Object value)
Returns true if this map maps one or more keys to the specified value.
|
boolean |
equals(Object obj)
Force to redefine equals for the implementations of immutable collection classes.
|
default void |
forEach(BiConsumer<? super K,? super V> action)
Performs the given action for each entry in this map until all entries have been processed or the action throws an
exception.
|
V |
get(Object key)
Returns the value to which the specified key is mapped, or
null if this map contains no mapping for the key. |
default V |
getOrDefault(Object key,
V defaultValue)
Returns the value to which the specified key is mapped, or
defaultValue if this map contains no mapping for the
key. |
int |
hashCode()
Force to redefine hashCode for the implementations of immutable collection classes.
|
default boolean |
isCopy()
Return whether the internal storage is a (shallow) copy of the original map.
|
boolean |
isEmpty()
Returns true if this immutable collection contains no elements.
|
boolean |
isWrap()
Return whether the internal storage is a wrapped pointer to the original map.
|
ImmutableSet<K> |
keySet()
Returns a
Set view of the keys contained in this map. |
int |
size()
Returns the number of elements in this immutable collection.
|
Map<K,V> |
toMap()
Returns a modifiable copy of this immutable list.
|
ImmutableCollection<V> |
values()
Returns a
ImmutableCollection view of the values contained in this map. |
int size()
boolean isEmpty()
boolean containsKey(Object key)
key
- key whose presence in this map is to be testedClassCastException
- if the key is of an inappropriate type for this mapNullPointerException
- if the specified key is null and this map does not permit null keysboolean containsValue(Object value)
value
- value whose presence in this map is to be testedClassCastException
- if the value is of an inappropriate type for this mapNullPointerException
- if the specified value is null and this map does not permit null valuesV get(Object 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 keyClassCastException
- if the key is of an inappropriate type for this mapNullPointerException
- if the specified key is null and this map does not permit null keysImmutableSet<K> keySet()
Set
view of the keys contained in this map.ImmutableCollection<V> values()
ImmutableCollection
view of the values contained in this map.default V getOrDefault(Object key, V defaultValue)
defaultValue
if this map contains no mapping for the
key. The default implementation makes no guarantees about synchronization or atomicity properties of this method. Any
implementation providing atomicity guarantees must override this method and document its concurrency properties.key
- the key whose associated value is to be returneddefaultValue
- the default mapping of the keydefaultValue
if this map contains no mapping for the
keyClassCastException
- if the key is of an inappropriate type for this mapNullPointerException
- if the specified key is null and this map does not permit null keysdefault void forEach(BiConsumer<? super K,? super V> action)
action
- The action to be performed for each entryNullPointerException
- if the specified action is nullConcurrentModificationException
- if an entry is found to be removed during iterationMap<K,V> toMap()
boolean equals(Object obj)
int hashCode()
boolean isWrap()
default boolean isCopy()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.