Warning
The methods of ForwardingSortedMap forward indiscriminately to
the methods of the delegate. For example, overriding put alone will not change
the behavior of putAll, which can lead to unexpected behavior. In this case, you should
override putAll as well, either providing your own implementation, or delegating to the
provided standardPutAll method.
default method warning: This class does not forward calls to default methods. Instead, it inherits their default implementations. When those implementations
invoke methods, they invoke methods on the ForwardingSortedMap.
Each of the standard methods, where appropriate, use the comparator of the map to test
equality for both keys and values, unlike ForwardingMap.
The standard methods and the collection views they return are not guaranteed to be
thread-safe, even when all of the methods that they depend on are thread-safe.
| Modifier and Type | Class and Description |
|---|---|
| protected class | ForwardingSortedMap.
A sensible implementation of |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Comparator | comparator()
Implements java. null if this map uses the natural ordering of its keys.
|
| protected abstract SortedMap | delegate()
Implements abstract com. |
| public K | firstKey()
Implements java. |
| public SortedMap | headMap(K
high endpoint (exclusive) of the keys in the returned map toKey)Implements java. toKey.
|
| public K | lastKey()
Implements java. |
| protected boolean | standardContainsKey(Object key)
Overrides com. containsKey in terms of the firstKey() method of
tailMap.
|
| protected SortedMap | standardSubMap(K fromKey, K toKey)
A sensible default implementation of |
| public SortedMap | subMap(K
low endpoint (inclusive) of the keys in the returned map fromKey, K high endpoint (exclusive) of the keys in the returned map toKey)Implements java. fromKey, inclusive, to toKey, exclusive.
|
| public SortedMap | tailMap(K
low endpoint (inclusive) of the keys in the returned map fromKey)Implements java. fromKey.
|
| pack-priv static int |
| ForwardingSortedMap | back to summary |
|---|---|
| protected ForwardingSortedMap() Constructor for use by subclasses. | |
| comparator | back to summary |
|---|---|
| public Comparator Implements java. Doc from java. Returns the comparator used to order the keys in this map, or
| |
| delegate | back to summary |
|---|---|
| protected abstract SortedMap Implements abstract com. Doc from com. Returns the backing delegate instance that methods are forwarded to. Abstract subclasses
generally override this method with an abstract method that has a more specific return type,
such as
| |
| firstKey | back to summary |
|---|---|
| public K firstKey() Implements java. Doc from java. Returns the first (lowest) key currently in this map.
| |
| headMap | back to summary |
|---|---|
| public SortedMap Implements java. Doc from java. Returns a view of the portion of this map whose keys are
strictly less than The returned map will throw an | |
| lastKey | back to summary |
|---|---|
| public K lastKey() Implements java. Doc from java. Returns the last (highest) key currently in this map.
| |
| standardContainsKey | back to summary |
|---|---|
| protected boolean standardContainsKey(Object key) Overrides com. A sensible definition of
| |
| standardSubMap | back to summary |
|---|---|
| protected SortedMap A sensible default implementation of
| |
| subMap | back to summary |
|---|---|
| public SortedMap Implements java. Doc from java. Returns a view of the portion of this map whose keys range from
The returned map will throw an | |
| tailMap | back to summary |
|---|---|
| public SortedMap Implements java. Doc from java. Returns a view of the portion of this map whose keys are
greater than or equal to The returned map will throw an | |
| unsafeCompare | back to summary |
|---|---|
pack-priv static int unsafeCompare(Comparator<?> comparator, Object o1, Object o2)
| |
SortedMap#keySet in terms of the methods of ForwardingSortedMap. In many cases, you may wish to override ForwardingSortedMap#keySet to forward to this implementation or a subclass thereof.
| Access | Constructor and Description |
|---|---|
| public |
| StandardKeySet | back to summary |
|---|---|
| public StandardKeySet() Constructor for use by subclasses. | |