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

public abstract Class AbstractDualBidiMap<K, V>

extends Object
implements BidiMap<K, V>
Class Inheritance
All Implemented Interfaces
org.apache.commons.collections4.BidiMap, org.apache.commons.collections4.IterableMap, org.apache.commons.collections4.IterableGet, org.apache.commons.collections4.Get, org.apache.commons.collections4.Put, java.util.Map
Known Direct Subclasses
org.apache.commons.collections4.bidimap.DualHashBidiMap, org.apache.commons.collections4.bidimap.DualLinkedHashBidiMap, org.apache.commons.collections4.bidimap.DualTreeBidiMap
Type Parameters
<K>
the type of the keys in the map
<V>
the type of the values in the map
Imports
java.util.Collection, .Iterator, .Map, .Set, .Objects, java.util.function.Predicate, org.apache.commons.collections4.BidiMap, .MapIterator, .ResettableIterator, org.apache.commons.collections4.collection.AbstractCollectionDecorator, org.apache.commons.collections4.iterators.AbstractIteratorDecorator, org.apache.commons.collections4.keyvalue.AbstractMapEntryDecorator

Abstract BidiMap implemented using two maps.

An implementation can be written simply by implementing the createBidiMap(Map, Map, BidiMap) method.

Since
3.0
See Also
DualHashBidiMap, DualTreeBidiMap

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
AbstractDualBidiMap.BidiMapIterator<K, V>

Inner class MapIterator.

protected static class
AbstractDualBidiMap.EntrySet<K, V>

Inner class EntrySet.

protected static class
AbstractDualBidiMap.EntrySetIterator<K, V>

Inner class EntrySetIterator.

protected static class
AbstractDualBidiMap.KeySet<K>

Inner class KeySet.

protected static class
AbstractDualBidiMap.KeySetIterator<K>

Inner class KeySetIterator.

protected static class
AbstractDualBidiMap.MapEntry<K, V>

Inner class MapEntry.

protected static class
AbstractDualBidiMap.Values<V>

Inner class Values.

protected static class
AbstractDualBidiMap.ValuesIterator<V>

Inner class ValuesIterator.

protected abstract static class
AbstractDualBidiMap.View<K, V, E>

Inner class View.

Field Summary

Modifier and TypeField and Description
pack-priv transient Set<Map.Entry<K, V>>
entrySet

View of the entries.

pack-priv transient BidiMap<V, K>
inverseBidiMap

Inverse view of this map.

pack-priv transient Set<K>
keySet

View of the keys.

pack-priv transient Map<K, V>
normalMap

Normal delegate map.

pack-priv transient Map<V, K>
reverseMap

Reverse delegate map.

pack-priv transient Set<V>
values

View of the values.

Constructor Summary

AccessConstructor and Description
protected
AbstractDualBidiMap()

Creates an empty map, initialised by createMap.

protected
AbstractDualBidiMap(final Map<K, V>
the normal direction map
normalMap
,
final Map<V, K>
the reverse direction map
reverseMap
)

Creates an empty map using the two maps specified as storage.

protected
AbstractDualBidiMap(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 map that decorates the specified maps, used by the subclass createBidiMap implementation.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements java.util.Map.clear, org.apache.commons.collections4.Put.clear.

Removes all of the mappings from this map (optional operation).
public boolean
containsKey(final Object
key whose presence in this map is to be tested
key
)

Implements java.util.Map.containsKey, org.apache.commons.collections4.Get.containsKey.

Returns true if this map contains a mapping for the specified key.
public boolean
containsValue(final Object
value whose presence in this map is to be tested
value
)

Implements java.util.Map.containsValue, org.apache.commons.collections4.Get.containsValue.

Returns true if this map maps one or more keys to the specified value.
protected abstract BidiMap<V, K>

Returns:

the inverse map
createBidiMap
(Map<V, K>
the normal direction map
normalMap
,
Map<K, V>
the reverse direction map
reverseMap
,
BidiMap<K, V>
this map, which is the inverse in the new map
inverseMap
)

Creates a new instance of the subclass.

protected Iterator<Map.Entry<K, V>>

Returns:

the entrySet iterator
createEntrySetIterator
(final Iterator<Map.Entry<K, V>>
the iterator to decorate
iterator
)

Creates an entry set iterator.

protected Iterator<K>

Returns:

the keySet iterator
createKeySetIterator
(final Iterator<K>
the iterator to decorate
iterator
)

Creates a key set iterator.

protected Iterator<V>

Returns:

the values iterator
createValuesIterator
(final Iterator<V>
the iterator to decorate
iterator
)

Creates a values iterator.

public Set<Map.Entry<K, V>>

Returns:

the entrySet view
entrySet
()

Implements java.util.Map.entrySet, org.apache.commons.collections4.Get.entrySet.

Gets an entrySet view of the map.
public boolean
equals(final Object
object to be compared for equality with this map
obj
)

Overrides java.lang.Object.equals.

Implements java.util.Map.equals.

Compares the specified object with this map for equality.
public V
get(final Object
the key whose associated value is to be returned
key
)

Implements java.util.Map.get, org.apache.commons.collections4.Get.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
public K
getKey(final Object
the value to find the key for
value
)

Implements org.apache.commons.collections4.BidiMap.getKey.

Gets the key that is currently mapped to the specified value.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.hashCode.

Returns the hash code value for this map.
public BidiMap<V, K>
inverseBidiMap()

Implements org.apache.commons.collections4.BidiMap.inverseBidiMap.

Gets a view of this map where the keys and values are reversed.
public boolean
isEmpty()

Implements java.util.Map.isEmpty, org.apache.commons.collections4.Get.isEmpty.

Returns true if this map contains no key-value mappings.
public Set<K>

Returns:

the keySet view
keySet
()

Implements java.util.Map.keySet, org.apache.commons.collections4.Get.keySet.

Gets a keySet view of the map.
public MapIterator<K, V>

Returns:

a map iterator
mapIterator
()

Implements org.apache.commons.collections4.IterableGet.mapIterator.

Obtains a MapIterator over the map.
public V
put(final K
the key to store
key
,
final V
the value to store
value
)

Implements org.apache.commons.collections4.BidiMap.put.

Puts the key-value pair into the map, replacing any previous pair.
public void
putAll(final Map<? extends K, ? extends V>
mappings to be stored in this map
map
)

Implements java.util.Map.putAll, org.apache.commons.collections4.Put.putAll.

Copies all of the mappings from the specified map to this map (optional operation).
public V
remove(final Object
key whose mapping is to be removed from the map
key
)

Implements java.util.Map.remove, org.apache.commons.collections4.Get.remove.

Removes the mapping for a key from this map if it is present (optional operation).
public K
removeValue(final Object
the value to find the key-value pair for
value
)

Implements org.apache.commons.collections4.BidiMap.removeValue.

Removes the key-value pair that is currently mapped to the specified value (optional operation).
public int
size()

Implements java.util.Map.size, org.apache.commons.collections4.Get.size.

Returns the number of key-value mappings in this map.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public Set<V>

Returns:

the values view
values
()

Implements org.apache.commons.collections4.BidiMap.values.

Gets a values view of the map.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait