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,V>, AbstractMap.SimpleImmutableEntry<K, V> -
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> static <KType,VType>
ImmutableOpenMap.Builder<KType, VType> builder(KType key, VType value) booleancontainsKey(Object key) Returnstrueif this container has an association to a value for the given key.booleancontainsValue(Object value) entrySet()booleanvoidforEach(BiConsumer<? super KType, ? super VType> action) getOrDefault(Object key, VType defaultValue) inthashCode()booleanisEmpty()keySet()static <KType,VType>
ImmutableOpenMap<KType, VType> of()intsize()toString()values()Methods inherited from class java.util.AbstractMap
clear, clone, put, putAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
get
- Specified by:
getin interfaceMap<KType,VType> - Overrides:
getin 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
Returnstrueif this container has an association to a value for the given key.- Specified by:
containsKeyin interfaceMap<KType,VType> - Overrides:
containsKeyin classAbstractMap<KType,VType>
-
containsValue
- Specified by:
containsValuein interfaceMap<KType,VType> - Overrides:
containsValuein classAbstractMap<KType,VType>
-
remove
-
size
public int size() -
isEmpty
public boolean isEmpty() -
entrySet
-
equals
-
hashCode
public int hashCode() -
keySet
-
values
-
forEach
-
toString
- Overrides:
toStringin classAbstractMap<KType,VType>
-
of
-
builder
-
builder
-
builder
-
builder
-