Top Description Inners Fields Constructors Methods
com.google.common.collect

pack-priv final Class ImmutableEnumMap<K extends Enum<K>, V>

extends ImmutableMap.IteratorBasedImmutableMap<K extends Enum<K>, V>
Class Inheritance
Annotations
@GwtCompatible
serializable:true
emulated:true
@SuppressWarnings:serial
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument

Implementation of ImmutableMap backed by a non-empty java.util.EnumMap.
Author
Louis Wasserman

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final transient EnumMap<K, V>

Constructor Summary

AccessConstructor and Description
private
ImmutableEnumMap(EnumMap<K, V> delegate)

Method Summary

Modifier and TypeMethod and Description
pack-priv static <K extends Enum<K>, V> ImmutableMap<K, V>
asImmutable(EnumMap<K, V> map)

public boolean
containsKey(Object
key whose presence in this map is to be tested
key
)

Overrides com.google.common.collect.ImmutableMap.containsKey.

Implements java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key.
pack-priv UnmodifiableIterator<Map.Entry<K, V>>
pack-priv Spliterator<Map.Entry<K, V>>
public boolean
equals(Object
object to be compared for equality with this map
object
)

Overrides com.google.common.collect.ImmutableMap.equals.

Implements java.util.Map.equals.

Compares the specified object with this map for equality.
public void
forEach(BiConsumer<? super K, ? super V>
The action to be performed for each entry
action
)

Overrides default java.util.Map.forEach.

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
public V
get(Object
the key whose associated value is to be returned
key
)

Implements abstract com.google.common.collect.ImmutableMap.get.

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
pack-priv boolean
pack-priv UnmodifiableIterator<K>
pack-priv Spliterator<K>
private void
public int
size()

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.
pack-priv Object
Inherited from com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap:
createEntrySetcreateKeySetcreateValues

Field Detail

delegateback to summary
private final transient EnumMap<K, V> delegate

Constructor Detail

ImmutableEnumMapback to summary
private ImmutableEnumMap(EnumMap<K, V> delegate)

Method Detail

asImmutableback to summary
pack-priv static <K extends Enum<K>, V> ImmutableMap<K, V> asImmutable(EnumMap<K, V> map)
containsKeyback to summary
public boolean containsKey(Object key)

Overrides com.google.common.collect.ImmutableMap.containsKey.

Implements java.util.Map.containsKey.

Doc from java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Objects.equals(key, k). (There can be at most one such mapping.)

Parameters
key:Object

key whose presence in this map is to be tested

Returns:boolean

true if this map contains a mapping for the specified key

Annotations
@Override
entryIteratorback to summary
pack-priv UnmodifiableIterator<Map.Entry<K, V>> entryIterator()

Implements abstract com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap.entryIterator.

Annotations
@Override
entrySpliteratorback to summary
pack-priv Spliterator<Map.Entry<K, V>> entrySpliterator()

Overrides com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap.entrySpliterator.

Annotations
@Override
equalsback to summary
public boolean equals(Object object)

Overrides com.google.common.collect.ImmutableMap.equals.

Implements java.util.Map.equals.

Doc from java.util.Map.equals.

Compares the specified object with this map for equality. Returns true if the given object is also a map and the two maps represent the same mappings. More formally, two maps m1 and m2 represent the same mappings if m1.entrySet().equals(m2.entrySet()). This ensures that the equals method works properly across different implementations of the Map interface.

Parameters
object:Object

object to be compared for equality with this map

Returns:boolean

true if the specified object is equal to this map

Annotations
@Override
forEachback to summary
public void forEach(BiConsumer<? super K, ? super V> action)

Overrides default java.util.Map.forEach.

Doc from java.util.Map.forEach.

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of entry set iteration (if an iteration order is specified.) Exceptions thrown by the action are relayed to the caller.

Parameters
action:BiConsumer<? super K, ? super V>

The action to be performed for each entry

Annotations
@Override
getback to summary
public V get(Object key)

Implements abstract com.google.common.collect.ImmutableMap.get.

Implements java.util.Map.get.

Doc from java.util.Map.get.

Returns the value to which the specified key is mapped, or 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 Objects.equals(key, 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.

Parameters
key:Object

the key whose associated value is to be returned

Returns:V

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Annotations
@Override
@CheckForNull
isPartialViewback to summary
pack-priv boolean isPartialView()

Implements abstract com.google.common.collect.ImmutableMap.isPartialView.

Annotations
@Override
keyIteratorback to summary
pack-priv UnmodifiableIterator<K> keyIterator()

Overrides com.google.common.collect.ImmutableMap.keyIterator.

Annotations
@Override
keySpliteratorback to summary
pack-priv Spliterator<K> keySpliterator()

Overrides com.google.common.collect.ImmutableMap.keySpliterator.

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream stream) throws InvalidObjectException

Hides com.google.common.collect.ImmutableMap.readObject.

Annotations
@J2ktIncompatible
sizeback to summary
public int size()

Implements java.util.Map.size.

Doc from java.util.Map.size.

Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of key-value mappings in this map

Annotations
@Override
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ImmutableMap.IteratorBasedImmutableMap.writeReplace.

Doc from com.google.common.collect.ImmutableMap.writeReplace.

Returns a serializable form of this object. Non-public subclasses should not override this method. Publicly-accessible subclasses must override this method and should return a subclass of SerializedForm whose readResolve() method returns objects of the subclass type.

Annotations
@Override
@J2ktIncompatible
com.google.common.collect back to summary

private Class ImmutableEnumMap.EnumSerializedForm<K extends Enum<K>, V>

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • com.google.common.collect.ImmutableEnumMap.EnumSerializedForm
All Implemented Interfaces
java.io.Serializable
Annotations
@J2ktIncompatible

Field Summary

Modifier and TypeField and Description
pack-priv final EnumMap<K, V>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
EnumSerializedForm(EnumMap<K, V> delegate)

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
pack-priv final EnumMap<K, V> delegate
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

EnumSerializedFormback to summary
pack-priv EnumSerializedForm(EnumMap<K, V> delegate)

Method Detail

readResolveback to summary
pack-priv Object readResolve()