Class ForwardingNavigableMap<K,V>
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- com.google.common.collect.ForwardingMap<K,V>
-
- com.google.common.collect.ForwardingSortedMap<K,V>
-
- com.google.common.collect.ForwardingNavigableMap<K,V>
-
- All Implemented Interfaces:
java.util.Map<K,V>
,java.util.NavigableMap<K,V>
,java.util.SortedMap<K,V>
public abstract class ForwardingNavigableMap<K,V> extends ForwardingSortedMap<K,V> implements java.util.NavigableMap<K,V>
A navigable map which forwards all its method calls to another navigable map. Subclasses should override one or more methods to modify the behavior of the backing map as desired per the decorator pattern.Warning: The methods of
ForwardingNavigableMap
forward indiscriminately to the methods of the delegate. For example, overridingForwardingMap.put(K, V)
alone will not change the behavior ofForwardingMap.putAll(java.util.Map<? extends K, ? extends V>)
, which can lead to unexpected behavior. In this case, you should overrideputAll
as well, either providing your own implementation, or delegating to the providedstandardPutAll
method.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 theMap
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map.Entry<K,V>
ceilingEntry(K key)
K
ceilingKey(K key)
java.util.NavigableSet<K>
descendingKeySet()
java.util.NavigableMap<K,V>
descendingMap()
java.util.Map.Entry<K,V>
firstEntry()
java.util.Map.Entry<K,V>
floorEntry(K key)
K
floorKey(K key)
java.util.NavigableMap<K,V>
headMap(K toKey, boolean inclusive)
java.util.Map.Entry<K,V>
higherEntry(K key)
K
higherKey(K key)
java.util.Map.Entry<K,V>
lastEntry()
java.util.Map.Entry<K,V>
lowerEntry(K key)
K
lowerKey(K key)
java.util.NavigableSet<K>
navigableKeySet()
java.util.Map.Entry<K,V>
pollFirstEntry()
java.util.Map.Entry<K,V>
pollLastEntry()
java.util.NavigableMap<K,V>
subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
java.util.NavigableMap<K,V>
tailMap(K fromKey, boolean inclusive)
-
Methods inherited from class com.google.common.collect.ForwardingSortedMap
comparator, firstKey, headMap, lastKey, subMap, tailMap
-
Methods inherited from class com.google.common.collect.ForwardingMap
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
-
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
-
-
-
Method Detail
-
navigableKeySet
public java.util.NavigableSet<K> navigableKeySet()
-
descendingKeySet
public java.util.NavigableSet<K> descendingKeySet()
-
subMap
public java.util.NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
-
-