Class DualTreeBidiMap
- java.lang.Object
-
- org.apache.commons.collections.bidimap.AbstractDualBidiMap
-
- org.apache.commons.collections.bidimap.DualTreeBidiMap
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.Map
,java.util.SortedMap
,BidiMap
,IterableMap
,OrderedBidiMap
,OrderedMap
,SortedBidiMap
@Deprecated(since="2021-04-30") public class DualTreeBidiMap extends AbstractDualBidiMap implements SortedBidiMap, java.io.Serializable
Deprecated.Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.Implementation ofBidiMap
that uses twoTreeMap
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 flawedcreateMap
method is ignored.- Since:
- Commons Collections 3.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DualTreeBidiMap()
Deprecated.Creates an emptyDualTreeBidiMap
DualTreeBidiMap(java.util.Comparator comparator)
Deprecated.Constructs aDualTreeBidiMap
using the specified Comparator.DualTreeBidiMap(java.util.Map map)
Deprecated.Constructs aDualTreeBidiMap
and copies the mappings from specifiedMap
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Comparator
comparator()
Deprecated.java.lang.Object
firstKey()
Deprecated.Gets the first key currently in this map.java.util.SortedMap
headMap(java.lang.Object toKey)
Deprecated.OrderedBidiMap
inverseOrderedBidiMap()
Deprecated.Gets a view of this map where the keys and values are reversed.SortedBidiMap
inverseSortedBidiMap()
Deprecated.Gets a view of this map where the keys and values are reversed.java.lang.Object
lastKey()
Deprecated.Gets the last key currently in this map.java.lang.Object
nextKey(java.lang.Object key)
Deprecated.Gets the next key after the one specified.OrderedMapIterator
orderedMapIterator()
Deprecated.Obtains an ordered map iterator.java.lang.Object
previousKey(java.lang.Object key)
Deprecated.Gets the previous key before the one specified.java.util.SortedMap
subMap(java.lang.Object fromKey, java.lang.Object toKey)
Deprecated.java.util.SortedMap
tailMap(java.lang.Object fromKey)
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, values
-
Methods inherited from interface org.apache.commons.collections.BidiMap
getKey, mapIterator, put, removeValue
-
Methods 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, size
-
Methods inherited from interface org.apache.commons.collections.SortedBidiMap
inverseBidiMap
-
-
-
-
Constructor Detail
-
DualTreeBidiMap
public DualTreeBidiMap()
Deprecated.Creates an emptyDualTreeBidiMap
-
DualTreeBidiMap
public DualTreeBidiMap(java.util.Map map)
Deprecated.Constructs aDualTreeBidiMap
and copies the mappings from specifiedMap
.- Parameters:
map
- the map whose mappings are to be placed in this map
-
DualTreeBidiMap
public DualTreeBidiMap(java.util.Comparator comparator)
Deprecated.Constructs aDualTreeBidiMap
using the specified Comparator.- Parameters:
comparator
- the Comparator
-
-
Method Detail
-
comparator
public java.util.Comparator comparator()
Deprecated.- Specified by:
comparator
in interfacejava.util.SortedMap
-
firstKey
public java.lang.Object firstKey()
Deprecated.Description copied from interface:OrderedMap
Gets the first key currently in this map.- Specified by:
firstKey
in interfaceOrderedMap
- Specified by:
firstKey
in interfacejava.util.SortedMap
- Returns:
- the first key currently in this map
-
lastKey
public java.lang.Object lastKey()
Deprecated.Description copied from interface:OrderedMap
Gets the last key currently in this map.- Specified by:
lastKey
in interfaceOrderedMap
- Specified by:
lastKey
in interfacejava.util.SortedMap
- Returns:
- the last key currently in this map
-
nextKey
public java.lang.Object nextKey(java.lang.Object key)
Deprecated.Description copied from interface:OrderedMap
Gets the next key after the one specified.- Specified by:
nextKey
in interfaceOrderedMap
- Parameters:
key
- the key to search for next from- Returns:
- the next key, null if no match or at end
-
previousKey
public java.lang.Object previousKey(java.lang.Object key)
Deprecated.Description copied from interface:OrderedMap
Gets the previous key before the one specified.- Specified by:
previousKey
in interfaceOrderedMap
- Parameters:
key
- the key to search for previous from- Returns:
- the previous key, null if no match or at start
-
orderedMapIterator
public OrderedMapIterator 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:
orderedMapIterator
in interfaceOrderedMap
- Returns:
- a new ordered map iterator
-
inverseSortedBidiMap
public SortedBidiMap inverseSortedBidiMap()
Deprecated.Description copied from interface:SortedBidiMap
Gets 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:
inverseSortedBidiMap
in interfaceSortedBidiMap
- Returns:
- an inverted bidirectional map
-
inverseOrderedBidiMap
public OrderedBidiMap inverseOrderedBidiMap()
Deprecated.Description copied from interface:OrderedBidiMap
Gets 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:
inverseOrderedBidiMap
in interfaceOrderedBidiMap
- Returns:
- an inverted bidirectional map
-
headMap
public java.util.SortedMap headMap(java.lang.Object toKey)
Deprecated.- Specified by:
headMap
in interfacejava.util.SortedMap
-
tailMap
public java.util.SortedMap tailMap(java.lang.Object fromKey)
Deprecated.- Specified by:
tailMap
in interfacejava.util.SortedMap
-
subMap
public java.util.SortedMap subMap(java.lang.Object fromKey, java.lang.Object toKey)
Deprecated.- Specified by:
subMap
in interfacejava.util.SortedMap
-
-