- All Implemented Interfaces:
Map<K,,V> SequencedMap<K,,V> SortedMap<K,V>
- Direct Known Subclasses:
ForwardingNavigableMap
Warning: The methods of ForwardingSortedMap 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 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.
- Since:
- 2.0
- Author:
- Mike Bostock, Louis Wasserman
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA sensible implementation ofSortedMap.keySet()in terms of the methods ofForwardingSortedMap.Nested classes/interfaces inherited from class com.google.common.collect.ForwardingMap
ForwardingMap.StandardEntrySet, ForwardingMap.StandardValues -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Comparator<? super K> delegate()Returns the backing delegate instance that methods are forwarded to.firstKey()lastKey()protected booleanA sensible definition ofForwardingMap.containsKey(java.lang.Object)in terms of thefirstKey()method oftailMap(K).standardSubMap(K fromKey, K toKey) A sensible default implementation ofsubMap(Object, Object)in terms ofheadMap(Object)andtailMap(Object).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, 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.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry, sequencedEntrySet, sequencedKeySet, sequencedValues
-
Constructor Details
-
ForwardingSortedMap
protected ForwardingSortedMap()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. -
comparator
-
firstKey
-
headMap
-
lastKey
-
subMap
-
tailMap
-
standardContainsKey
A sensible definition ofForwardingMap.containsKey(java.lang.Object)in terms of thefirstKey()method oftailMap(K). If you overridetailMap(K), you may wish to overrideForwardingMap.containsKey(java.lang.Object)to forward to this implementation.- Overrides:
standardContainsKeyin classForwardingMap<K extends @Nullable Object, V extends @Nullable Object>- Since:
- 7.0
-
standardSubMap
A sensible default implementation ofsubMap(Object, Object)in terms ofheadMap(Object)andtailMap(Object). In some situations, you may wish to overridesubMap(Object, Object)to forward to this implementation.- Since:
- 7.0
-