Top Description Fields Constructors Methods
org.apache.commons.collections4.bidimap

public Class DualHashBidiMap<K, V>

extends AbstractDualBidiMap<K, V>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Type Parameters
<K>
the type of the keys in the map
<V>
the type of the values in the map
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.HashMap, .Map, org.apache.commons.collections4.BidiMap

Implementation of BidiMap that uses two HashMap instances.

Two HashMap instances are used in this class. This provides fast lookups at the expense of storing two sets of map entries. Commons Collections would welcome the addition of a direct hash-based implementation of the BidiMap interface.

Note

From Commons Collections 3.1, all subclasses will use HashMap and the flawed createMap method is ignored.

Since
3.0

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Ensure serialization compatibility

Inherited from org.apache.commons.collections4.bidimap.AbstractDualBidiMap:
entrySetinverseBidiMapkeySetnormalMapreverseMapvalues

Constructor Summary

AccessConstructor and Description
public
DualHashBidiMap()

Creates an empty HashBidiMap.

public
DualHashBidiMap(final Map<? extends K, ? extends V>
the map whose mappings are to be placed in this map
map
)

Constructs a HashBidiMap and copies the mappings from specified Map.

protected
DualHashBidiMap(final Map<K, V>
the normal direction map
normalMap
,
final Map<V, K>
the reverse direction map
reverseMap
,
final BidiMap<V, K>
the inverse BidiMap
inverseBidiMap
)

Constructs a HashBidiMap that decorates the specified maps.

Method Summary

Modifier and TypeMethod and Description
protected BidiMap<V, K>

Returns:

new bidi map
createBidiMap
(final Map<V, K>
the normal direction map
normalMap
,
final Map<K, V>
the reverse direction map
reverseMap
,
final BidiMap<K, V>
the inverse BidiMap
inverseBidiMap
)

Implements abstract org.apache.commons.collections4.bidimap.AbstractDualBidiMap.createBidiMap.

Creates a new instance of this object.
private void
private void
Inherited from org.apache.commons.collections4.bidimap.AbstractDualBidiMap:
clearcontainsKeycontainsValuecreateEntrySetIteratorcreateKeySetIteratorcreateValuesIteratorentrySetequalsgetgetKeyhashCodeinverseBidiMapisEmptykeySetmapIteratorputputAllremoveremoveValuesizetoStringvalues

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Ensure serialization compatibility

Constructor Detail

DualHashBidiMapback to summary
public DualHashBidiMap()

Creates an empty HashBidiMap.

DualHashBidiMapback to summary
public DualHashBidiMap(final Map<? extends K, ? extends V> map)

Constructs a HashBidiMap and copies the mappings from specified Map.

Parameters
map:Map<? extends K, ? extends V>

the map whose mappings are to be placed in this map

DualHashBidiMapback to summary
protected DualHashBidiMap(final Map<K, V> normalMap, final Map<V, K> reverseMap, final BidiMap<V, K> inverseBidiMap)

Constructs a HashBidiMap that decorates the specified maps.

Parameters
normalMap:Map<K, V>

the normal direction map

reverseMap:Map<V, K>

the reverse direction map

inverseBidiMap:BidiMap<V, K>

the inverse BidiMap

Method Detail

createBidiMapback to summary
protected BidiMap<V, K> createBidiMap(final Map<V, K> normalMap, final Map<K, V> reverseMap, final BidiMap<K, V> inverseBidiMap)

Implements abstract org.apache.commons.collections4.bidimap.AbstractDualBidiMap.createBidiMap.

Creates a new instance of this object.

Parameters
normalMap:Map<V, K>

the normal direction map

reverseMap:Map<K, V>

the reverse direction map

inverseBidiMap:BidiMap<K, V>

the inverse BidiMap

Returns:BidiMap<V, K>

new bidi map

Annotations
@Override
readObjectback to summary
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException
writeObjectback to summary
private void writeObject(final ObjectOutputStream out) throws IOException