Package org.elasticsearch.common.collect
Class ImmutableOpenMap<KType,VType>
java.lang.Object
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(ImmutableOpenMap)
(which is an optimized
option to copy over existing content and modify it).
-
Nested Class Summary
-
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> builder
(ImmutableOpenMap<KType, VType> map) void
clear()
boolean
containsKey
(Object key) Returnstrue
if this container has an association to a value for the given key.boolean
containsValue
(Object value) entrySet()
boolean
getOrDefault
(Object key, VType defaultValue) int
hashCode()
boolean
isEmpty()
keySet()
static <KType,
VType>
ImmutableOpenMap<KType,VType> of()
void
int
size()
toString()
values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
get
- Specified by:
get
in interfaceMap<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
- Specified by:
getOrDefault
in interfaceMap<KType,
VType> - 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>
-
containsValue
- Specified by:
containsValue
in interfaceMap<KType,
VType>
-
put
-
remove
-
putAll
-
clear
public void clear() -
size
public int size() -
isEmpty
public boolean isEmpty() -
entrySet
-
keySet
-
values
-
toString
-
equals
-
hashCode
public int hashCode() -
of
-
builder
-
builder
-
builder
public static <KType,VType> ImmutableOpenMap.Builder<KType,VType> builder(ImmutableOpenMap<KType, VType> map)
-