org.apache.commons.collections.bidimap
public class DualTreeBidiMap extends AbstractDualBidiMap implements SortedBidiMap, Serializable
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
Version: $Id: DualTreeBidiMap.java 155406 2005-02-26 12:55:26Z dirkv $
Nested Class Summary | |
---|---|
protected static class | DualTreeBidiMap.BidiOrderedMapIterator
Inner class MapIterator. |
protected static class | DualTreeBidiMap.ViewMap
Internal sorted map view. |
Field Summary | |
---|---|
protected Comparator | comparator The comparator to use |
Constructor Summary | |
---|---|
DualTreeBidiMap()
Creates an empty DualTreeBidiMap | |
DualTreeBidiMap(Map map)
Constructs a DualTreeBidiMap and copies the mappings from
specified Map .
| |
DualTreeBidiMap(Comparator comparator)
Constructs a DualTreeBidiMap using the specified Comparator.
| |
protected | DualTreeBidiMap(Map normalMap, Map reverseMap, BidiMap inverseBidiMap)
Constructs a DualTreeBidiMap that decorates the specified maps.
|
Method Summary | |
---|---|
Comparator | comparator() |
protected BidiMap | createBidiMap(Map normalMap, Map reverseMap, BidiMap inverseMap)
Creates a new instance of this object.
|
Object | firstKey() |
SortedMap | headMap(Object toKey) |
OrderedBidiMap | inverseOrderedBidiMap() |
SortedBidiMap | inverseSortedBidiMap() |
Object | lastKey() |
Object | nextKey(Object key) |
OrderedMapIterator | orderedMapIterator()
Obtains an ordered map iterator.
|
Object | previousKey(Object key) |
SortedMap | subMap(Object fromKey, Object toKey) |
SortedMap | tailMap(Object fromKey) |
DualTreeBidiMap
DualTreeBidiMap
and copies the mappings from
specified Map
.
Parameters: map the map whose mappings are to be placed in this map
DualTreeBidiMap
using the specified Comparator.
Parameters: comparator the Comparator
DualTreeBidiMap
that decorates the specified maps.
Parameters: normalMap the normal direction map reverseMap the reverse direction map inverseBidiMap the inverse BidiMap
Parameters: normalMap the normal direction map reverseMap the reverse direction map inverseMap the inverse BidiMap
Returns: new bidi map
This implementation copies the elements to an ArrayList in order to provide the forward/backward behaviour.
Returns: a new ordered map iterator