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

public final Class EnumBiMap<K extends java.lang.Enum<K>, V extends java.lang.Enum<V>>

extends AbstractBiMap<K extends Enum<K>, V extends Enum<V>>
Class Inheritance
Annotations
@GwtCompatible
emulated:true
@J2ktIncompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkNotNull, com.google.common.collect.Platform.getDeclaringClassOrObjectForJ2cl

A BiMap backed by two EnumMap instances. Null keys and values are not permitted. An EnumBiMap and its inverse are both serializable.

See the Guava User Guide article on BiMap.

Author
Mike Bostock
Since
2.0

Field Summary

Modifier and TypeField and Description
pack-priv transient Class<K>
private static final long
pack-priv transient Class<V>
Inherited from com.google.common.collect.AbstractBiMap:
inverse

Constructor Summary

AccessConstructor and Description
private
EnumBiMap(Class<K> keyTypeOrObjectUnderJ2cl, Class<V> valueTypeOrObjectUnderJ2cl)

Method Summary

Modifier and TypeMethod and Description
pack-priv K
checkKey(K key)

Overrides com.google.common.collect.AbstractBiMap.checkKey.

Returns its input, or throws an exception if this is not a valid key.
pack-priv V
checkValue(V value)

Overrides com.google.common.collect.AbstractBiMap.checkValue.

Returns its input, or throws an exception if this is not a valid value.
public static <K extends Enum<K>, V extends Enum<V>> EnumBiMap<K, V>
create(Class<K>
the key type
keyType
,
Class<V>
the value type
valueType
)

Returns a new, empty EnumBiMap using the specified key and value types.

public static <K extends Enum<K>, V extends Enum<V>> EnumBiMap<K, V>
create(Map<K, V>
the map whose mappings are to be placed in this map
map
)

Returns a new bimap with the same mappings as the specified map.

pack-priv static <K extends Enum<K>> Class<K>
private static <V extends Enum<V>> Class<V>
public Class<K>
keyType()

Returns the associated key type.

private void
public Class<V>
valueType()

Returns the associated value type.

private void
Inherited from com.google.common.collect.AbstractBiMap:
clearcontainsValuedelegateentrySetentrySetIteratorforcePutinversekeySetmakeInverseputputAllremovereplaceAllsetDelegatessetInversevalues

Field Detail

keyTypeOrObjectUnderJ2clback to summary
pack-priv transient Class<K> keyTypeOrObjectUnderJ2cl
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.google.common.collect.AbstractBiMap.serialVersionUID.

Annotations
@GwtIncompatible
valueTypeOrObjectUnderJ2clback to summary
pack-priv transient Class<V> valueTypeOrObjectUnderJ2cl

Constructor Detail

EnumBiMapback to summary
private EnumBiMap(Class<K> keyTypeOrObjectUnderJ2cl, Class<V> valueTypeOrObjectUnderJ2cl)

Method Detail

checkKeyback to summary
pack-priv K checkKey(K key)

Overrides com.google.common.collect.AbstractBiMap.checkKey.

Doc from com.google.common.collect.AbstractBiMap.checkKey.

Returns its input, or throws an exception if this is not a valid key.

Annotations
@Override
checkValueback to summary
pack-priv V checkValue(V value)

Overrides com.google.common.collect.AbstractBiMap.checkValue.

Doc from com.google.common.collect.AbstractBiMap.checkValue.

Returns its input, or throws an exception if this is not a valid value.

Annotations
@Override
createback to summary
public static <K extends Enum<K>, V extends Enum<V>> EnumBiMap<K, V> create(Class<K> keyType, Class<V> valueType)

Returns a new, empty EnumBiMap using the specified key and value types.

Parameters
keyType:Class<K>

the key type

valueType:Class<V>

the value type

createback to summary
public static <K extends Enum<K>, V extends Enum<V>> EnumBiMap<K, V> create(Map<K, V> map)

Returns a new bimap with the same mappings as the specified map. If the specified map is an EnumBiMap, the new bimap has the same types as the provided map. Otherwise, the specified map must contain at least one mapping, in order to determine the key and value types.

Parameters
map:Map<K, V>

the map whose mappings are to be placed in this map

Exceptions
IllegalArgumentException:
if map is not an EnumBiMap instance and contains no mappings
inferKeyTypeOrObjectUnderJ2clback to summary
pack-priv static <K extends Enum<K>> Class<K> inferKeyTypeOrObjectUnderJ2cl(Map<K, ?> map)
inferValueTypeOrObjectUnderJ2clback to summary
private static <V extends Enum<V>> Class<V> inferValueTypeOrObjectUnderJ2cl(Map<?, V> map)
keyTypeback to summary
public Class<K> keyType()

Returns the associated key type.

Annotations
@GwtIncompatible
readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
Annotations
@SuppressWarnings:unchecked
@GwtIncompatible
valueTypeback to summary
public Class<V> valueType()

Returns the associated value type.

Annotations
@GwtIncompatible
writeObjectback to summary
private void writeObject(ObjectOutputStream stream) throws IOException
Annotations
@GwtIncompatible
Serial data
the key class, value class, number of entries, first key, first value, second key, second value, and so on.