Package com.google.common.collect
Class ForwardingNavigableMap.StandardDescendingMap
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingMap<K,V>
-
- com.google.common.collect.ForwardingNavigableMap.StandardDescendingMap
-
- All Implemented Interfaces:
Map<K,V>,NavigableMap<K,V>,SortedMap<K,V>
protected class ForwardingNavigableMap.StandardDescendingMap extends ForwardingMap<K,V>
A sensible implementation ofNavigableMap.descendingMap()in terms of the methods of thisNavigableMap. In many cases, you may wish to overrideForwardingNavigableMap.descendingMap()to forward to this implementation or a subclass thereof.In particular, this map iterates over entries with repeated calls to
NavigableMap.lowerEntry(K). If a more efficient means of iteration is available, you may wish to override theentryIterator()method of this class.- Since:
- 12.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ForwardingMap
ForwardingMap.StandardEntrySet, ForwardingMap.StandardKeySet, ForwardingMap.StandardValues
-
-
Constructor Summary
Constructors Constructor Description StandardDescendingMap()Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map.Entry<K,V>ceilingEntry(K key)KceilingKey(K key)Comparator<? super K>comparator()protected Map<K,V>delegate()Returns the backing delegate instance that methods are forwarded to.NavigableSet<K>descendingKeySet()NavigableMap<K,V>descendingMap()protected Iterator<Map.Entry<K,V>>entryIterator()Set<Map.Entry<K,V>>entrySet()Map.Entry<K,V>firstEntry()KfirstKey()Map.Entry<K,V>floorEntry(K key)KfloorKey(K key)SortedMap<K,V>headMap(K toKey)NavigableMap<K,V>headMap(K toKey, boolean inclusive)Map.Entry<K,V>higherEntry(K key)KhigherKey(K key)Set<K>keySet()Map.Entry<K,V>lastEntry()KlastKey()Map.Entry<K,V>lowerEntry(K key)KlowerKey(K key)NavigableSet<K>navigableKeySet()Map.Entry<K,V>pollFirstEntry()Map.Entry<K,V>pollLastEntry()voidreplaceAll(BiFunction<? super K,? super V,? extends V> function)NavigableMap<K,V>subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)SortedMap<K,V>subMap(K fromKey, K toKey)SortedMap<K,V>tailMap(K fromKey)NavigableMap<K,V>tailMap(K fromKey, boolean inclusive)StringtoString()Returns the string representation generated by the delegate'stoStringmethod.Collection<V>values()-
Methods inherited from class com.google.common.collect.ForwardingMap
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size, standardClear, standardContainsKey, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString
-
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, size
-
-
-
-
Constructor Detail
-
StandardDescendingMap
public StandardDescendingMap()
Constructor for use by subclasses.
-
-
Method Detail
-
replaceAll
public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
-
entryIterator
protected Iterator<Map.Entry<K,V>> entryIterator()
-
delegate
protected final Map<K,V> 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
public Comparator<? super K> comparator()
-
firstKey
public K firstKey()
-
lastKey
public K lastKey()
-
lowerEntry
@CheckForNull public Map.Entry<K,V> lowerEntry(K key)
- Specified by:
lowerEntryin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
lowerKey
@CheckForNull public K lowerKey(K key)
-
floorEntry
@CheckForNull public Map.Entry<K,V> floorEntry(K key)
- Specified by:
floorEntryin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
floorKey
@CheckForNull public K floorKey(K key)
-
ceilingEntry
@CheckForNull public Map.Entry<K,V> ceilingEntry(K key)
- Specified by:
ceilingEntryin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
ceilingKey
@CheckForNull public K ceilingKey(K key)
- Specified by:
ceilingKeyin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
higherEntry
@CheckForNull public Map.Entry<K,V> higherEntry(K key)
- Specified by:
higherEntryin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
higherKey
@CheckForNull public K higherKey(K key)
-
firstEntry
@CheckForNull public Map.Entry<K,V> firstEntry()
- Specified by:
firstEntryin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
lastEntry
@CheckForNull public Map.Entry<K,V> lastEntry()
-
pollFirstEntry
@CheckForNull public Map.Entry<K,V> pollFirstEntry()
- Specified by:
pollFirstEntryin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
pollLastEntry
@CheckForNull public Map.Entry<K,V> pollLastEntry()
- Specified by:
pollLastEntryin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
descendingMap
public NavigableMap<K,V> descendingMap()
- Specified by:
descendingMapin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
keySet
public Set<K> keySet()
-
navigableKeySet
public NavigableSet<K> navigableKeySet()
- Specified by:
navigableKeySetin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
descendingKeySet
public NavigableSet<K> descendingKeySet()
- Specified by:
descendingKeySetin interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
subMap
public NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
-
subMap
public SortedMap<K,V> subMap(K fromKey, K toKey)
-
headMap
public NavigableMap<K,V> headMap(K toKey, boolean inclusive)
-
headMap
public SortedMap<K,V> headMap(K toKey)
-
tailMap
public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
-
tailMap
public SortedMap<K,V> tailMap(K fromKey)
-
values
public Collection<V> values()
-
toString
public String toString()
Description copied from class:ForwardingObjectReturns the string representation generated by the delegate'stoStringmethod.- Overrides:
toStringin classForwardingObject
-
-