java.lang.Object | ||
↳ | org.apache.commons.collections.bidimap.AbstractDualBidiMap | |
↳ | org.apache.commons.collections.bidimap.DualTreeBidiMap |
Implementation of 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.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DualTreeBidiMap.BidiOrderedMapIterator | Inner class MapIterator. | ||||||||||
DualTreeBidiMap.ViewMap | Internal sorted map view. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
comparator | The comparator to use |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.commons.collections.bidimap.AbstractDualBidiMap
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an empty
DualTreeBidiMap
| |||||||||||
Constructs a
DualTreeBidiMap and copies the mappings from
specified Map . | |||||||||||
Constructs a
DualTreeBidiMap using the specified Comparator. |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a
DualTreeBidiMap that decorates the specified maps. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the first key currently in this map.
| |||||||||||
Gets a view of this map where the keys and values are reversed.
| |||||||||||
Gets a view of this map where the keys and values are reversed.
| |||||||||||
Gets the last key currently in this map.
| |||||||||||
Gets the next key after the one specified.
| |||||||||||
Obtains an ordered map iterator.
| |||||||||||
Gets the previous key before the one specified.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new instance of this object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.commons.collections.bidimap.AbstractDualBidiMap
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.util.Map
| |||||||||||
From interface
java.util.SortedMap
| |||||||||||
From interface
org.apache.commons.collections.BidiMap
| |||||||||||
From interface
org.apache.commons.collections.IterableMap
| |||||||||||
From interface
org.apache.commons.collections.OrderedBidiMap
| |||||||||||
From interface
org.apache.commons.collections.OrderedMap
| |||||||||||
From interface
org.apache.commons.collections.SortedBidiMap
|
Creates an empty DualTreeBidiMap
Constructs a DualTreeBidiMap
and copies the mappings from
specified Map
.
map | the map whose mappings are to be placed in this map |
---|
Constructs a DualTreeBidiMap
using the specified Comparator.
comparator | the Comparator |
---|
Constructs a DualTreeBidiMap
that decorates the specified maps.
normalMap | the normal direction map |
---|---|
reverseMap | the reverse direction map |
inverseBidiMap | the inverse BidiMap |
Gets the first key currently in this map.
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.
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.
Gets the last key currently in this map.
Gets the next key after the one specified.
key | the key to search for next from |
---|
Obtains an ordered map iterator.
This implementation copies the elements to an ArrayList in order to provide the forward/backward behaviour.
Gets the previous key before the one specified.
key | the key to search for previous from |
---|
Creates a new instance of this object.
normalMap | the normal direction map |
---|---|
reverseMap | the reverse direction map |
inverseMap | the inverse BidiMap |