This map works the same way as TransformingMap, but also implements SortedMap.
A comparator can be specified during the construction of this map, which will be reported when comparator()
is called. When this map is used as the argument to a constructor of a sorted map (E.g.
TreeMap.TreeMap(
Important: Implementations should ensure that the transformed keys are ordered by the comparator of this constructed map. Violating this may result in undefined behaviour in some implementations.
The use-case for this map is the same as for TransformingMap. See the documentation of that class for more information.
protected final Comparator< | The comparator that this map is ordered by. |
public | TransformingSortedMap( Creates a new instance with the given map. |
public | TransformingSortedMap( Creates a new instance with the given map and comparator. |
public Comparator< | Returns the comparator used to order the keys in this map, or null if this map uses the
natural ordering of its keys. |
public K | firstKey() Returns the first (lowest) key currently in this map. |
public SortedMap< | headMap( Returns a view of the portion of this map whose keys are strictly less than toKey . |
public K | lastKey() Returns the last (highest) key currently in this map. |
public SortedMap< | subMap( Returns a view of the portion of this map whose keys range from fromKey , inclusive, to toKey ,
exclusive. |
public SortedMap< | tailMap( Returns a view of the portion of this map whose keys are greater than or equal to fromKey . |
From: TransformingMap< |
From: SortedMap< |
From: AbstractMap< |
From: Map< |
From: Object |
null
.null
.null
if this map uses the
natural ordering of its keys.null
if this map uses the natural ordering
of its keystoKey
. 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.
toKey
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.
fromKey
, inclusive, to toKey
,
exclusivefromKey
. 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.
fromKey