- All Implemented Interfaces:
Map<K,
,V> NavigableMap<K,
,V> SequencedMap<K,
,V> SortedMap<K,
V>
Warning: The methods of ForwardingNavigableMap
forward indiscriminately
to the methods of the delegate. For example, overriding ForwardingMap.put(K, V)
alone will not change
the behavior of ForwardingMap.putAll(java.util.Map<? extends K, ? extends V>)
, 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 ForwardingNavigableMap
.
Each of the standard
methods uses the map's comparator (or the natural ordering of the
elements, if there is no comparator) to test element equality. As a result, if the comparator is
not consistent with equals, some of the standard implementations may violate the Map
contract.
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.
- Since:
- 12.0
- Author:
- Louis Wasserman
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
A sensible implementation ofNavigableMap.descendingMap()
in terms of the methods of thisNavigableMap
.protected class
A sensible implementation ofNavigableMap.navigableKeySet()
in terms of the methods of thisNavigableMap
.Nested classes/interfaces inherited from class com.google.common.collect.ForwardingSortedMap
ForwardingSortedMap.StandardKeySet
Nested classes/interfaces inherited from class com.google.common.collect.ForwardingMap
ForwardingMap.StandardEntrySet, ForwardingMap.StandardValues
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor for use by subclasses. -
Method Summary
Modifier and TypeMethodDescriptionceilingEntry
(K key) ceilingKey
(K key) protected abstract NavigableMap
<K, V> delegate()
Returns the backing delegate instance that methods are forwarded to.floorEntry
(K key) higherEntry
(K key) lowerEntry
(K key) standardCeilingEntry
(K key) standardCeilingKey
(K key) A sensible definition ofceilingKey(K)
in terms ofceilingEntry
.protected NavigableSet
<K> protected K
A sensible definition ofForwardingSortedMap.firstKey()
in terms offirstEntry
.standardFloorEntry
(K key) standardFloorKey
(K key) A sensible definition offloorKey(K)
in terms offloorEntry
.standardHeadMap
(K toKey) A sensible definition ofForwardingSortedMap.headMap(Object)
in terms ofheadMap(Object, boolean)
.standardHigherEntry
(K key) standardHigherKey
(K key) A sensible definition ofhigherKey(K)
in terms ofhigherEntry
.A sensible definition oflastEntry()
in terms of theiterator()
of theForwardingMap.entrySet()
ofdescendingMap()
.protected K
A sensible definition ofForwardingSortedMap.lastKey()
in terms oflastEntry
.standardLowerEntry
(K key) standardLowerKey
(K key) A sensible definition oflowerKey(K)
in terms oflowerEntry
.A sensible definition ofpollFirstEntry()
in terms of theiterator
of theentrySet
ofdescendingMap
.standardSubMap
(K fromKey, K toKey) A sensible definition ofForwardingSortedMap.subMap(Object, Object)
in terms ofsubMap(Object, boolean, Object, boolean)
.standardTailMap
(K fromKey) A sensible definition ofForwardingSortedMap.tailMap(Object)
in terms oftailMap(Object, boolean)
.Methods inherited from class com.google.common.collect.ForwardingSortedMap
comparator, firstKey, headMap, lastKey, standardContainsKey, subMap, tailMap
Methods inherited from class com.google.common.collect.ForwardingMap
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, standardClear, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString, values
Methods inherited from class com.google.common.collect.ForwardingObject
toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
Methods inherited from interface java.util.NavigableMap
headMap, reversed, subMap, tailMap
Methods inherited from interface java.util.SequencedMap
sequencedEntrySet, sequencedKeySet, sequencedValues
-
Constructor Details
-
ForwardingNavigableMap
protected ForwardingNavigableMap()Constructor for use by subclasses.
-
-
Method Details
-
delegate
Description copied from class:ForwardingObject
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 asForwardingSet.delegate()
. Concrete subclasses override this method to supply the instance being decorated. -
lowerEntry
- Specified by:
lowerEntry
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardLowerEntry
A sensible definition oflowerEntry(K)
in terms of thelastEntry()
ofheadMap(Object, boolean)
. If you overrideheadMap
, you may wish to overridelowerEntry
to forward to this implementation. -
lowerKey
-
standardLowerKey
A sensible definition oflowerKey(K)
in terms oflowerEntry
. If you overridelowerEntry(K)
, you may wish to overridelowerKey
to forward to this implementation. -
floorEntry
- Specified by:
floorEntry
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardFloorEntry
A sensible definition offloorEntry(K)
in terms of thelastEntry()
ofheadMap(Object, boolean)
. If you overrideheadMap
, you may wish to overridefloorEntry
to forward to this implementation. -
floorKey
-
standardFloorKey
A sensible definition offloorKey(K)
in terms offloorEntry
. If you overridefloorEntry
, you may wish to overridefloorKey
to forward to this implementation. -
ceilingEntry
- Specified by:
ceilingEntry
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardCeilingEntry
A sensible definition ofceilingEntry(K)
in terms of thefirstEntry()
oftailMap(Object, boolean)
. If you overridetailMap
, you may wish to overrideceilingEntry
to forward to this implementation. -
ceilingKey
- Specified by:
ceilingKey
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardCeilingKey
A sensible definition ofceilingKey(K)
in terms ofceilingEntry
. If you overrideceilingEntry
, you may wish to overrideceilingKey
to forward to this implementation. -
higherEntry
- Specified by:
higherEntry
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardHigherEntry
A sensible definition ofhigherEntry(K)
in terms of thefirstEntry()
oftailMap(Object, boolean)
. If you overridetailMap
, you may wish to overridehigherEntry
to forward to this implementation. -
higherKey
-
standardHigherKey
A sensible definition ofhigherKey(K)
in terms ofhigherEntry
. If you overridehigherEntry
, you may wish to overridehigherKey
to forward to this implementation. -
firstEntry
- Specified by:
firstEntry
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object> - Specified by:
firstEntry
in interfaceSequencedMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardFirstEntry
A sensible definition offirstEntry()
in terms of theiterator()
ofForwardingMap.entrySet()
. If you overrideentrySet
, you may wish to overridefirstEntry
to forward to this implementation. -
standardFirstKey
A sensible definition ofForwardingSortedMap.firstKey()
in terms offirstEntry
. If you overridefirstEntry
, you may wish to overridefirstKey
to forward to this implementation. -
lastEntry
-
standardLastEntry
A sensible definition oflastEntry()
in terms of theiterator()
of theForwardingMap.entrySet()
ofdescendingMap()
. If you overridedescendingMap
, you may wish to overridelastEntry
to forward to this implementation. -
standardLastKey
A sensible definition ofForwardingSortedMap.lastKey()
in terms oflastEntry
. If you overridelastEntry
, you may wish to overridelastKey
to forward to this implementation. -
pollFirstEntry
- Specified by:
pollFirstEntry
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object> - Specified by:
pollFirstEntry
in interfaceSequencedMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardPollFirstEntry
A sensible definition ofpollFirstEntry()
in terms of theiterator
ofentrySet
. If you overrideentrySet
, you may wish to overridepollFirstEntry
to forward to this implementation. -
pollLastEntry
- Specified by:
pollLastEntry
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object> - Specified by:
pollLastEntry
in interfaceSequencedMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardPollLastEntry
A sensible definition ofpollFirstEntry()
in terms of theiterator
of theentrySet
ofdescendingMap
. If you overridedescendingMap
, you may wish to overridepollFirstEntry
to forward to this implementation. -
descendingMap
- Specified by:
descendingMap
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object>
-
descendingKeySet
- Specified by:
descendingKeySet
in interfaceNavigableMap<K extends @Nullable Object,
V extends @Nullable Object>
-
standardDescendingKeySet
A sensible definition ofdescendingKeySet()
as thenavigableKeySet
ofdescendingMap()
. (TheForwardingNavigableMap<K extends @Nullable Object,
implementation implementsV extends @Nullable Object>.StandardDescendingMap navigableKeySet
on its own, so as not to cause an infinite loop.) If you overridedescendingMap
, you may wish to overridedescendingKeySet
to forward to this implementation. -
standardSubMap
A sensible definition ofForwardingSortedMap.subMap(Object, Object)
in terms ofsubMap(Object, boolean, Object, boolean)
. If you overridesubMap(K, boolean, K, boolean)
, you may wish to overridesubMap
to forward to this implementation.- Overrides:
standardSubMap
in classForwardingSortedMap<K extends @Nullable Object,
V extends @Nullable Object>
-
subMap
-
headMap
-
tailMap
-
standardHeadMap
A sensible definition ofForwardingSortedMap.headMap(Object)
in terms ofheadMap(Object, boolean)
. If you overrideheadMap(K, boolean)
, you may wish to overrideheadMap
to forward to this implementation. -
standardTailMap
A sensible definition ofForwardingSortedMap.tailMap(Object)
in terms oftailMap(Object, boolean)
. If you overridetailMap(K, boolean)
, you may wish to overridetailMap
to forward to this implementation.
-