Package com.google.common.collect
Class ImmutableMapEntry<K,V>
java.lang.Object
com.google.common.collect.AbstractMapEntry<K,V>
com.google.common.collect.ImmutableEntry<K,V>
com.google.common.collect.ImmutableMapEntry<K,V>
- All Implemented Interfaces:
Serializable
,Map.Entry<K,
V>
- Direct Known Subclasses:
ImmutableMapEntry.NonTerminalImmutableMapEntry
Implementation of
Entry
for ImmutableMap
that adds extra methods to traverse hash
buckets for the key and the value. This allows reuse in RegularImmutableMap
and RegularImmutableBiMap
, which don't have to recopy the entries created by their Builder
implementations.
This base implementation has no key or value pointers, so instances of ImmutableMapEntry (but not its subclasses) can be reused when copied from one ImmutableMap to another.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
(package private) static class
-
Field Summary
Fields inherited from class com.google.common.collect.ImmutableEntry
key, value
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableMapEntry
(ImmutableMapEntry<K, V> contents) ImmutableMapEntry
(K key, V value) -
Method Summary
Modifier and TypeMethodDescription(package private) static <K,
V> ImmutableMapEntry<K, V>[] createEntryArray
(int size) Creates anImmutableMapEntry
array to hold parameterized entries.(package private) ImmutableMapEntry
<K, V> (package private) ImmutableMapEntry
<K, V> (package private) boolean
Returns true if this entry has no bucket links and can safely be reused as a terminal entry in a bucket in another map.Methods inherited from class com.google.common.collect.ImmutableEntry
getKey, getValue, setValue
Methods inherited from class com.google.common.collect.AbstractMapEntry
equals, hashCode, toString
-
Constructor Details
-
ImmutableMapEntry
-
ImmutableMapEntry
ImmutableMapEntry(ImmutableMapEntry<K, V> contents)
-
-
Method Details
-
createEntryArray
Creates anImmutableMapEntry
array to hold parameterized entries. The result must never be upcast back to ImmutableMapEntry[] (or Object[], etc.), or allowed to escape the class.The returned array has all its elements set to their initial null values. However, we don't declare it as
@Nullable ImmutableMapEntry[]
because our checker doesn't require newly created arrays to have a@Nullable
element type even when they're created directly withnew ImmutableMapEntry[...]
, so it seems silly to insist on that only here. -
getNextInKeyBucket
-
getNextInValueBucket
-
isReusable
boolean isReusable()Returns true if this entry has no bucket links and can safely be reused as a terminal entry in a bucket in another map.
-