Class DualTreeBidiMap
- All Implemented Interfaces:
Serializable,Map,SequencedMap,SortedMap,BidiMap,IterableMap,OrderedBidiMap,OrderedMap,SortedBidiMap
BidiMap that uses two TreeMap instances.
The setValue() method on iterators will succeed only if the new value being set is not already in the bidimap.
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:
- Commons Collections 3.0
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates an emptyDualTreeBidiMapDualTreeBidiMap(Comparator comparator) Deprecated.Constructs aDualTreeBidiMapusing the specified Comparator.DualTreeBidiMap(Map map) Deprecated.Constructs aDualTreeBidiMapand copies the mappings from specifiedMap. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.firstKey()Deprecated.Gets the first key currently in this map.Deprecated.Deprecated.Gets a view of this map where the keys and values are reversed.Deprecated.Gets a view of this map where the keys and values are reversed.lastKey()Deprecated.Gets the last key currently in this map.Deprecated.Gets the next key after the one specified.Deprecated.Obtains an ordered map iterator.previousKey(Object key) Deprecated.Gets the previous key before the one specified.Deprecated.Deprecated.Methods inherited from class org.apache.commons.collections.bidimap.AbstractDualBidiMap
clear, containsKey, containsValue, entrySet, equals, get, getKey, hashCode, inverseBidiMap, isEmpty, keySet, mapIterator, put, putAll, remove, removeValue, size, toString, valuesMethods inherited from interface org.apache.commons.collections.BidiMap
getKey, mapIterator, put, removeValueMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, sizeMethods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry, sequencedEntrySet, sequencedKeySet, sequencedValuesMethods inherited from interface org.apache.commons.collections.SortedBidiMap
inverseBidiMap
-
Constructor Details
-
DualTreeBidiMap
public DualTreeBidiMap()Deprecated.Creates an emptyDualTreeBidiMap -
DualTreeBidiMap
Deprecated.Constructs aDualTreeBidiMapand copies the mappings from specifiedMap.- Parameters:
map- the map whose mappings are to be placed in this map
-
DualTreeBidiMap
Deprecated.Constructs aDualTreeBidiMapusing the specified Comparator.- Parameters:
comparator- the Comparator
-
-
Method Details
-
comparator
Deprecated.- Specified by:
comparatorin interfaceSortedMap
-
firstKey
Deprecated.Description copied from interface:OrderedMapGets the first key currently in this map.- Specified by:
firstKeyin interfaceOrderedMap- Specified by:
firstKeyin interfaceSortedMap- Returns:
- the first key currently in this map
-
lastKey
Deprecated.Description copied from interface:OrderedMapGets the last key currently in this map.- Specified by:
lastKeyin interfaceOrderedMap- Specified by:
lastKeyin interfaceSortedMap- Returns:
- the last key currently in this map
-
nextKey
Deprecated.Description copied from interface:OrderedMapGets the next key after the one specified.- Specified by:
nextKeyin interfaceOrderedMap- Parameters:
key- the key to search for next from- Returns:
- the next key, null if no match or at end
-
previousKey
Deprecated.Description copied from interface:OrderedMapGets the previous key before the one specified.- Specified by:
previousKeyin interfaceOrderedMap- Parameters:
key- the key to search for previous from- Returns:
- the previous key, null if no match or at start
-
orderedMapIterator
Deprecated.Obtains an ordered map iterator.This implementation copies the elements to an ArrayList in order to provide the forward/backward behaviour.
- Specified by:
orderedMapIteratorin interfaceOrderedMap- Returns:
- a new ordered map iterator
-
inverseSortedBidiMap
Deprecated.Description copied from interface:SortedBidiMapGets 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
SortedMap.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.The inverse map returned by
inverseBidiMap()should be the same object as returned by this method.- Specified by:
inverseSortedBidiMapin interfaceSortedBidiMap- Returns:
- an inverted bidirectional map
-
inverseOrderedBidiMap
Deprecated.Description copied from interface:OrderedBidiMapGets 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 equally.
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:
inverseOrderedBidiMapin interfaceOrderedBidiMap- Returns:
- an inverted bidirectional map
-
headMap
Deprecated. -
tailMap
Deprecated. -
subMap
Deprecated.
-