Class DualTreeBidiMap<K,V> 
- Type Parameters:
- K- the type of the keys in this map
- V- the type of the values in this map
- All Implemented Interfaces:
- Serializable,- Map<K,,- V> - SortedMap<K,,- V> - BidiMap<K,,- V> - Get<K,,- V> - IterableGet<K,,- V> - IterableMap<K,,- V> - OrderedBidiMap<K,,- V> - OrderedMap<K,,- V> - Put<K,,- V> - SortedBidiMap<K,- V> 
BidiMap with two TreeMap instances.
 The setValue() method on iterators will succeed only if the new value being set is not already in the bidi map.
 When considering whether to use this class, the TreeBidiMap class should
 also be considered. It implements the interface using a dedicated design, and does
 not store each object twice, which can save on memory use.
 
 NOTE: From Commons Collections 3.1, all subclasses will use TreeMap
 and the flawed createMap method is ignored.
 
- Since:
- 3.0
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static classInner class MapIterator.protected static classInternal sorted map view.Nested classes/interfaces inherited from class org.apache.commons.collections4.bidimap.AbstractDualBidiMapAbstractDualBidiMap.BidiMapIterator<K,V>, AbstractDualBidiMap.EntrySet<K, V>, AbstractDualBidiMap.EntrySetIterator<K, V>, AbstractDualBidiMap.KeySet<K>, AbstractDualBidiMap.KeySetIterator<K>, AbstractDualBidiMap.MapEntry<K, V>, AbstractDualBidiMap.Values<V>, AbstractDualBidiMap.ValuesIterator<V>, AbstractDualBidiMap.View<K, V, E> 
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreates an emptyDualTreeBidiMap.DualTreeBidiMap(Comparator<? super K> keyComparator, Comparator<? super V> valueComparator) Constructs aDualTreeBidiMapusing the specifiedComparator.DualTreeBidiMap(Map<? extends K, ? extends V> map) Constructs aDualTreeBidiMapand copies the mappings from specifiedMap.protectedConstructs aDualTreeBidiMapthat decorates the specified maps.
- 
Method SummaryModifier and TypeMethodDescriptionComparator<? super K> protected DualTreeBidiMap<V, K> Creates a new instance of this object.firstKey()Gets the first key currently in this map.Gets a view of this map where the keys and values are reversed.Defaults toinverseBidiMap().Defaults toinverseBidiMap().lastKey()Gets the last key currently in this map.Obtains an ordered map iterator.Gets the next key after the one specified.previousKey(K key) Gets the previous key before the one specified.Comparator<? super V> Gets the comparator used for the values in the value-to-key map aspect.Methods inherited from class org.apache.commons.collections4.bidimap.AbstractDualBidiMapclear, containsKey, containsValue, createEntrySetIterator, createKeySetIterator, createValuesIterator, entrySet, equals, get, getKey, hashCode, isEmpty, keySet, put, putAll, remove, removeValue, size, toString, valuesMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.collections4.BidiMapgetKey, put, removeValue, valuesMethods inherited from interface org.apache.commons.collections4.GetcontainsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, valuesMethods inherited from interface java.util.Mapclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
- 
Constructor Details- 
DualTreeBidiMappublic DualTreeBidiMap()Creates an emptyDualTreeBidiMap.
- 
DualTreeBidiMapConstructs aDualTreeBidiMapusing the specifiedComparator.- Parameters:
- keyComparator- the comparator
- valueComparator- the values comparator to use
 
- 
DualTreeBidiMapConstructs aDualTreeBidiMapand copies the mappings from specifiedMap.- Parameters:
- map- the map whose mappings are to be placed in this map
 
- 
DualTreeBidiMap
 
- 
- 
Method Details- 
comparator- Specified by:
- comparatorin interface- SortedMap<K,- V> 
 
- 
createBidiMapprotected DualTreeBidiMap<V,K> createBidiMap(Map<V, K> normalMap, Map<K, V> reverseMap, BidiMap<K, V> inverseMap) Creates a new instance of this object.- Specified by:
- createBidiMapin class- AbstractDualBidiMap<K,- V> 
- Parameters:
- normalMap- the normal direction map
- reverseMap- the reverse direction map
- inverseMap- the inverse BidiMap
- Returns:
- new bidi map
 
- 
firstKey
- 
headMap
- 
inverseBidiMapDescription copied from interface:BidiMapGets a view of this map where the keys and values are reversed.Changes to one map will be visible in the other and vice versa. This enables both directions of the map to be accessed as a Map.Implementations should seek to avoid creating a new object every time this method is called. See AbstractMap.values()etc. Calling this method on the inverse map should return the original.- Specified by:
- inverseBidiMapin interface- BidiMap<K,- V> 
- Specified by:
- inverseBidiMapin interface- OrderedBidiMap<K,- V> 
- Specified by:
- inverseBidiMapin interface- SortedBidiMap<K,- V> 
- Overrides:
- inverseBidiMapin class- AbstractDualBidiMap<K,- V> 
- Returns:
- an inverted bidirectional map
 
- 
inverseOrderedBidiMapDefaults toinverseBidiMap().- Returns:
- Defaults to inverseBidiMap().
 
- 
inverseSortedBidiMapDefaults toinverseBidiMap().- Returns:
- Defaults to inverseBidiMap().
 
- 
lastKey
- 
mapIteratorObtains an ordered map iterator.This implementation copies the elements to an ArrayList in order to provide the forward/backward behavior. - Specified by:
- mapIteratorin interface- IterableGet<K,- V> 
- Specified by:
- mapIteratorin interface- OrderedMap<K,- V> 
- Overrides:
- mapIteratorin class- AbstractDualBidiMap<K,- V> 
- Returns:
- a new ordered map iterator
 
- 
nextKeyDescription copied from interface:OrderedMapGets the next key after the one specified.- Specified by:
- nextKeyin interface- OrderedMap<K,- V> 
- Parameters:
- key- the key to search for next from
- Returns:
- the next key, null if no match or at end
 
- 
previousKeyDescription copied from interface:OrderedMapGets the previous key before the one specified.- Specified by:
- previousKeyin interface- OrderedMap<K,- V> 
- Parameters:
- key- the key to search for previous from
- Returns:
- the previous key, null if no match or at start
 
- 
subMap
- 
tailMap
- 
valueComparatorDescription copied from interface:SortedBidiMapGets the comparator used for the values in the value-to-key map aspect.- Specified by:
- valueComparatorin interface- SortedBidiMap<K,- V> 
- Returns:
- Comparator<? super V>
 
 
-