- 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
Nested ClassesModifier and TypeClassDescriptionprotected classA sensible implementation ofNavigableMap.descendingMap()in terms of the methods of thisNavigableMap.protected classA sensible implementation ofNavigableMap.navigableKeySet()in terms of the methods of thisNavigableMap.Nested classes/interfaces inherited from class com.google.common.collect.ForwardingSortedMap
ForwardingSortedMap.StandardKeySetNested classes/interfaces inherited from class com.google.common.collect.ForwardingMap
ForwardingMap.StandardEntrySet, ForwardingMap.StandardValues -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor 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 KA 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 KA 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 theiteratorof theentrySetofdescendingMap.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, tailMapMethods 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, valuesMethods inherited from class com.google.common.collect.ForwardingObject
toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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, sizeMethods inherited from interface java.util.NavigableMap
headMap, reversed, subMap, tailMapMethods 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:ForwardingObjectReturns 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
-
standardLowerEntry
A sensible definition oflowerEntry(K)in terms of thelastEntry()ofheadMap(Object, boolean). If you overrideheadMap, you may wish to overridelowerEntryto forward to this implementation. -
lowerKey
-
standardLowerKey
A sensible definition oflowerKey(K)in terms oflowerEntry. If you overridelowerEntry(K), you may wish to overridelowerKeyto forward to this implementation. -
floorEntry
-
standardFloorEntry
A sensible definition offloorEntry(K)in terms of thelastEntry()ofheadMap(Object, boolean). If you overrideheadMap, you may wish to overridefloorEntryto forward to this implementation. -
floorKey
-
standardFloorKey
A sensible definition offloorKey(K)in terms offloorEntry. If you overridefloorEntry, you may wish to overridefloorKeyto forward to this implementation. -
ceilingEntry
-
standardCeilingEntry
A sensible definition ofceilingEntry(K)in terms of thefirstEntry()oftailMap(Object, boolean). If you overridetailMap, you may wish to overrideceilingEntryto forward to this implementation. -
ceilingKey
-
standardCeilingKey
A sensible definition ofceilingKey(K)in terms ofceilingEntry. If you overrideceilingEntry, you may wish to overrideceilingKeyto forward to this implementation. -
higherEntry
-
standardHigherEntry
A sensible definition ofhigherEntry(K)in terms of thefirstEntry()oftailMap(Object, boolean). If you overridetailMap, you may wish to overridehigherEntryto forward to this implementation. -
higherKey
-
standardHigherKey
A sensible definition ofhigherKey(K)in terms ofhigherEntry. If you overridehigherEntry, you may wish to overridehigherKeyto forward to this implementation. -
firstEntry
- Specified by:
firstEntryin interfaceNavigableMap<K extends @Nullable Object, V extends @Nullable Object>- Specified by:
firstEntryin 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 overridefirstEntryto forward to this implementation. -
standardFirstKey
A sensible definition ofForwardingSortedMap.firstKey()in terms offirstEntry. If you overridefirstEntry, you may wish to overridefirstKeyto 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 overridelastEntryto forward to this implementation. -
standardLastKey
A sensible definition ofForwardingSortedMap.lastKey()in terms oflastEntry. If you overridelastEntry, you may wish to overridelastKeyto forward to this implementation. -
pollFirstEntry
- Specified by:
pollFirstEntryin interfaceNavigableMap<K extends @Nullable Object, V extends @Nullable Object>- Specified by:
pollFirstEntryin interfaceSequencedMap<K extends @Nullable Object, V extends @Nullable Object>
-
standardPollFirstEntry
A sensible definition ofpollFirstEntry()in terms of theiteratorofentrySet. If you overrideentrySet, you may wish to overridepollFirstEntryto forward to this implementation. -
pollLastEntry
- Specified by:
pollLastEntryin interfaceNavigableMap<K extends @Nullable Object, V extends @Nullable Object>- Specified by:
pollLastEntryin interfaceSequencedMap<K extends @Nullable Object, V extends @Nullable Object>
-
standardPollLastEntry
A sensible definition ofpollFirstEntry()in terms of theiteratorof theentrySetofdescendingMap. If you overridedescendingMap, you may wish to overridepollFirstEntryto forward to this implementation. -
descendingMap
- Specified by:
descendingMapin interfaceNavigableMap<K extends @Nullable Object, V extends @Nullable Object>
-
descendingKeySet
- Specified by:
descendingKeySetin interfaceNavigableMap<K extends @Nullable Object, V extends @Nullable Object>
-
standardDescendingKeySet
A sensible definition ofdescendingKeySet()as thenavigableKeySetofdescendingMap(). (TheForwardingNavigableMap<K extends @Nullable Object, V extends @Nullable Object>.StandardDescendingMapimplementation implementsnavigableKeySeton its own, so as not to cause an infinite loop.) If you overridedescendingMap, you may wish to overridedescendingKeySetto 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 overridesubMapto forward to this implementation.- Overrides:
standardSubMapin 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 overrideheadMapto 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 overridetailMapto forward to this implementation.
-