public class DualHashBidiMap extends AbstractDualBidiMap implements java.io.Serializable
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.
AbstractDualBidiMap.BidiMapIterator, AbstractDualBidiMap.EntrySet, AbstractDualBidiMap.EntrySetIterator, AbstractDualBidiMap.KeySet, AbstractDualBidiMap.KeySetIterator, AbstractDualBidiMap.MapEntry, AbstractDualBidiMap.Values, AbstractDualBidiMap.ValuesIterator, AbstractDualBidiMap.View
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
Ensure serialization compatibility
|
entrySet, inverseBidiMap, keySet, maps, values
Modifier | Constructor and Description |
---|---|
|
DualHashBidiMap()
Creates an empty
HashBidiMap . |
|
DualHashBidiMap(java.util.Map map)
Constructs a
HashBidiMap and copies the mappings from
specified Map . |
protected |
DualHashBidiMap(java.util.Map normalMap,
java.util.Map reverseMap,
BidiMap inverseBidiMap)
Constructs a
HashBidiMap that decorates the specified maps. |
Modifier and Type | Method and Description |
---|---|
protected BidiMap |
createBidiMap(java.util.Map normalMap,
java.util.Map reverseMap,
BidiMap inverseBidiMap)
Creates a new instance of this object.
|
private void |
readObject(java.io.ObjectInputStream in) |
private void |
writeObject(java.io.ObjectOutputStream out) |
clear, containsKey, containsValue, createEntrySetIterator, createKeySetIterator, createMap, createValuesIterator, entrySet, equals, get, getKey, hashCode, inverseBidiMap, isEmpty, keySet, mapIterator, put, putAll, remove, removeValue, size, toString, values
private static final long serialVersionUID
public DualHashBidiMap()
HashBidiMap
.public DualHashBidiMap(java.util.Map map)
HashBidiMap
and copies the mappings from
specified Map
.map
- the map whose mappings are to be placed in this mapprotected DualHashBidiMap(java.util.Map normalMap, java.util.Map reverseMap, BidiMap inverseBidiMap)
HashBidiMap
that decorates the specified maps.normalMap
- the normal direction mapreverseMap
- the reverse direction mapinverseBidiMap
- the inverse BidiMapprotected BidiMap createBidiMap(java.util.Map normalMap, java.util.Map reverseMap, BidiMap inverseBidiMap)
createBidiMap
in class AbstractDualBidiMap
normalMap
- the normal direction mapreverseMap
- the reverse direction mapinverseBidiMap
- the inverse BidiMapprivate void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException