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)
K
ceilingKey(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()
K
firstKey()
Map.Entry<K,V>
floorEntry(K key)
K
floorKey(K key)
SortedMap<K,V>
headMap(K toKey)
NavigableMap<K,V>
headMap(K toKey, boolean inclusive)
Map.Entry<K,V>
higherEntry(K key)
K
higherKey(K key)
Set<K>
keySet()
Map.Entry<K,V>
lastEntry()
K
lastKey()
Map.Entry<K,V>
lowerEntry(K key)
K
lowerKey(K key)
NavigableSet<K>
navigableKeySet()
Map.Entry<K,V>
pollFirstEntry()
Map.Entry<K,V>
pollLastEntry()
void
replaceAll(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)
String
toString()
Returns the string representation generated by the delegate'stoString
method.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: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.
-
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:
lowerEntry
in 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:
floorEntry
in 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:
ceilingEntry
in interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
ceilingKey
@CheckForNull public K ceilingKey(K key)
- Specified by:
ceilingKey
in interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
higherEntry
@CheckForNull public Map.Entry<K,V> higherEntry(K key)
- Specified by:
higherEntry
in 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:
firstEntry
in 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:
pollFirstEntry
in interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
pollLastEntry
@CheckForNull public Map.Entry<K,V> pollLastEntry()
- Specified by:
pollLastEntry
in interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
descendingMap
public NavigableMap<K,V> descendingMap()
- Specified by:
descendingMap
in interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
keySet
public Set<K> keySet()
-
navigableKeySet
public NavigableSet<K> navigableKeySet()
- Specified by:
navigableKeySet
in interfaceNavigableMap<K extends @Nullable Object,V extends @Nullable Object>
-
descendingKeySet
public NavigableSet<K> descendingKeySet()
- Specified by:
descendingKeySet
in 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:ForwardingObject
Returns the string representation generated by the delegate'stoString
method.- Overrides:
toString
in classForwardingObject
-
-