Top Description Constructors Methods
org.apache.commons.collections4.bidimap

public abstract Class AbstractSortedBidiMapDecorator<K, V>

extends AbstractOrderedBidiMapDecorator<K, V>
implements SortedBidiMap<K, V>
Class Inheritance
All Implemented Interfaces
org.apache.commons.collections4.SortedBidiMap, java.util.SortedMap, java.util.SequencedMap, java.util.Map, org.apache.commons.collections4.OrderedBidiMap, org.apache.commons.collections4.OrderedMap, org.apache.commons.collections4.IterableMap, org.apache.commons.collections4.IterableGet, org.apache.commons.collections4.Get, org.apache.commons.collections4.Put, org.apache.commons.collections4.BidiMap
Known Direct Subclasses
org.apache.commons.collections4.bidimap.UnmodifiableSortedBidiMap
Type Parameters
<K>
the type of the keys in this map
<V>
the type of the values in this map
Imports
java.util.Comparator, .SortedMap, org.apache.commons.collections4.SortedBidiMap

Provides a base decorator that enables additional functionality to be added to a SortedBidiMap via decoration.

Methods are forwarded directly to the decorated map.

This implementation does not perform any special processing with the map views. Instead it simply returns the inverse from the wrapped map. This may be undesirable, for example if you are trying to write a validating implementation it would provide a loophole around the validation. But, you might want that loophole, so this class is kept simple.

Since
3.0

Constructor Summary

AccessConstructor and Description
public
AbstractSortedBidiMapDecorator(final SortedBidiMap<K, V>
the map to decorate, must not be null
map
)

Constructor that wraps (not copies).

Method Summary

Modifier and TypeMethod and Description
public Comparator<? super K>
comparator()

Implements java.util.SortedMap.comparator.

Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.
protected SortedBidiMap<K, V>

Returns:

the decorated map
decorated
()

Overrides org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator.decorated.

Gets the map being decorated.
public SortedMap<K, V>
headMap(final K
high endpoint (exclusive) of the keys in the returned map
toKey
)

Implements java.util.SortedMap.headMap.

Returns a view of the portion of this map whose keys are strictly less than toKey.
public SortedBidiMap<V, K>
public SortedMap<K, V>
subMap(final K
low endpoint (inclusive) of the keys in the returned map
fromKey
,
final K
high endpoint (exclusive) of the keys in the returned map
toKey
)

Implements java.util.SortedMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
public SortedMap<K, V>
tailMap(final K
low endpoint (inclusive) of the keys in the returned map
fromKey
)

Implements java.util.SortedMap.tailMap.

Returns a view of the portion of this map whose keys are greater than or equal to fromKey.
public Comparator<? super V>
valueComparator()

Implements org.apache.commons.collections4.SortedBidiMap.valueComparator.

Get the comparator used for the values in the value-to-key map aspect.
Inherited from org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator:
firstKeylastKeymapIteratornextKeypreviousKey

Constructor Detail

AbstractSortedBidiMapDecoratorback to summary
public AbstractSortedBidiMapDecorator(final SortedBidiMap<K, V> map)

Constructor that wraps (not copies).

Parameters
map:SortedBidiMap<K, V>

the map to decorate, must not be null

Exceptions
NullPointerException:
if the collection is null

Method Detail

comparatorback to summary
public Comparator<? super K> comparator()

Implements java.util.SortedMap.comparator.

Doc from java.util.SortedMap.comparator.

Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.

Returns:Comparator<? super K>

the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys

Annotations
@Override
decoratedback to summary
protected SortedBidiMap<K, V> decorated()

Overrides org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator.decorated.

Gets the map being decorated.

Returns:SortedBidiMap<K, V>

the decorated map

Annotations
@Override
headMapback to summary
public SortedMap<K, V> headMap(final K toKey)

Implements java.util.SortedMap.headMap.

Doc from java.util.SortedMap.headMap.

Returns a view of the portion of this map whose keys are strictly less than toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
toKey:K

high endpoint (exclusive) of the keys in the returned map

Returns:SortedMap<K, V>

a view of the portion of this map whose keys are strictly less than toKey

Annotations
@Override
inverseBidiMapback to summary
public SortedBidiMap<V, K> inverseBidiMap()

Overrides org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator.inverseBidiMap.

Implements org.apache.commons.collections4.SortedBidiMap.inverseBidiMap, org.apache.commons.collections4.OrderedBidiMap.inverseBidiMap, org.apache.commons.collections4.BidiMap.inverseBidiMap.

Doc from org.apache.commons.collections4.SortedBidiMap.inverseBidiMap.

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.

Implementations must return a SortedBidiMap instance, usually by forwarding to inverseSortedBidiMap().

Returns:SortedBidiMap<V, K>

an inverted bidirectional map

Annotations
@Override
subMapback to summary
public SortedMap<K, V> subMap(final K fromKey, final K toKey)

Implements java.util.SortedMap.subMap.

Doc from java.util.SortedMap.subMap.

Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. (If fromKey and toKey are equal, the returned map is empty.) The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
fromKey:K

low endpoint (inclusive) of the keys in the returned map

toKey:K

high endpoint (exclusive) of the keys in the returned map

Returns:SortedMap<K, V>

a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive

Annotations
@Override
tailMapback to summary
public SortedMap<K, V> tailMap(final K fromKey)

Implements java.util.SortedMap.tailMap.

Doc from java.util.SortedMap.tailMap.

Returns a view of the portion of this map whose keys are greater than or equal to fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

Parameters
fromKey:K

low endpoint (inclusive) of the keys in the returned map

Returns:SortedMap<K, V>

a view of the portion of this map whose keys are greater than or equal to fromKey

Annotations
@Override
valueComparatorback to summary
public Comparator<? super V> valueComparator()

Implements org.apache.commons.collections4.SortedBidiMap.valueComparator.

Doc from org.apache.commons.collections4.SortedBidiMap.valueComparator.

Get the comparator used for the values in the value-to-key map aspect.

Returns:Comparator<? super V>

Comparator<? super V>

Annotations
@Override