Module org.elasticsearch.server
Package org.elasticsearch.common.collect
Class ImmutableOpenMap<KType,VType>
java.lang.Object
java.util.AbstractMap<KType,VType>
org.elasticsearch.common.collect.ImmutableOpenMap<KType,VType>
- All Implemented Interfaces:
Map<KType,
VType>
An immutable map implementation based on open hash map.
Can be constructed using a builder()
, or using builder(Map)
(which is an optimized
option to copy over existing content and modify it).
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Method Summary
Modifier and TypeMethodDescriptionstatic <KType,
VType>
ImmutableOpenMap.Builder<KType,VType> builder()
static <KType,
VType>
ImmutableOpenMap.Builder<KType,VType> builder
(int size) static <KType,
VType>
ImmutableOpenMap.Builder<KType,VType> boolean
containsKey
(Object key) Returnstrue
if this container has an association to a value for the given key.boolean
containsValue
(Object value) entrySet()
boolean
void
forEach
(BiConsumer<? super KType, ? super VType> action) getOrDefault
(Object key, VType defaultValue) int
hashCode()
boolean
isEmpty()
keySet()
static <KType,
VType>
ImmutableOpenMap<KType,VType> of()
int
size()
toString()
values()
Methods inherited from class java.util.AbstractMap
clear, clone, put, putAll
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
get
- Specified by:
get
in interfaceMap<KType,
VType> - Overrides:
get
in classAbstractMap<KType,
VType> - Returns:
- Returns the value associated with the given key or the default value
for the key type, if the key is not associated with any value.
Important note: For primitive type values, the value returned for a non-existing key may not be the default value of the primitive type (it may be any value previously assigned to that slot).
-
getOrDefault
- Returns:
- Returns the value associated with the given key or the provided default value if the key is not associated with any value.
-
containsKey
Returnstrue
if this container has an association to a value for the given key.- Specified by:
containsKey
in interfaceMap<KType,
VType> - Overrides:
containsKey
in classAbstractMap<KType,
VType>
-
containsValue
- Specified by:
containsValue
in interfaceMap<KType,
VType> - Overrides:
containsValue
in classAbstractMap<KType,
VType>
-
remove
-
size
public int size() -
isEmpty
public boolean isEmpty() -
entrySet
-
equals
-
hashCode
public int hashCode() -
keySet
-
values
-
forEach
-
toString
- Overrides:
toString
in classAbstractMap<KType,
VType>
-
of
-
builder
-
builder
-
builder
-