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:
Map<K,V>,NavigableMap<K,V>,SortedMap<K,V>
public abstract class ForwardingNavigableMap<K,V> extends ForwardingSortedMap<K,V> implements 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
ForwardingNavigableMapforward 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 overrideputAllas well, either providing your own implementation, or delegating to the providedstandardPutAllmethod.Each of the
standardmethods 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 theMapcontract.The
standardmethods 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 Map.Entry<K,V>ceilingEntry(K key)KceilingKey(K key)NavigableSet<K>descendingKeySet()NavigableMap<K,V>descendingMap()Map.Entry<K,V>firstEntry()Map.Entry<K,V>floorEntry(K key)KfloorKey(K key)NavigableMap<K,V>headMap(K toKey, boolean inclusive)Map.Entry<K,V>higherEntry(K key)KhigherKey(K key)Map.Entry<K,V>lastEntry()Map.Entry<K,V>lowerEntry(K key)KlowerKey(K key)NavigableSet<K>navigableKeySet()Map.Entry<K,V>pollFirstEntry()Map.Entry<K,V>pollLastEntry()NavigableMap<K,V>subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)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
-
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, replaceAll, size
-
Methods inherited from interface java.util.NavigableMap
headMap, subMap, tailMap
-
-
-
-
Method Detail
-
lowerEntry
public Map.Entry<K,V> lowerEntry(K key)
- Specified by:
lowerEntryin interfaceNavigableMap<K,V>
-
floorEntry
public Map.Entry<K,V> floorEntry(K key)
- Specified by:
floorEntryin interfaceNavigableMap<K,V>
-
ceilingEntry
public Map.Entry<K,V> ceilingEntry(K key)
- Specified by:
ceilingEntryin interfaceNavigableMap<K,V>
-
ceilingKey
public K ceilingKey(K key)
- Specified by:
ceilingKeyin interfaceNavigableMap<K,V>
-
higherEntry
public Map.Entry<K,V> higherEntry(K key)
- Specified by:
higherEntryin interfaceNavigableMap<K,V>
-
firstEntry
public Map.Entry<K,V> firstEntry()
- Specified by:
firstEntryin interfaceNavigableMap<K,V>
-
lastEntry
public Map.Entry<K,V> lastEntry()
- Specified by:
lastEntryin interfaceNavigableMap<K,V>
-
pollFirstEntry
public Map.Entry<K,V> pollFirstEntry()
- Specified by:
pollFirstEntryin interfaceNavigableMap<K,V>
-
pollLastEntry
public Map.Entry<K,V> pollLastEntry()
- Specified by:
pollLastEntryin interfaceNavigableMap<K,V>
-
descendingMap
public NavigableMap<K,V> descendingMap()
- Specified by:
descendingMapin interfaceNavigableMap<K,V>
-
navigableKeySet
public NavigableSet<K> navigableKeySet()
- Specified by:
navigableKeySetin interfaceNavigableMap<K,V>
-
descendingKeySet
public NavigableSet<K> descendingKeySet()
- Specified by:
descendingKeySetin interfaceNavigableMap<K,V>
-
subMap
public NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
- Specified by:
subMapin interfaceNavigableMap<K,V>
-
headMap
public NavigableMap<K,V> headMap(K toKey, boolean inclusive)
- Specified by:
headMapin interfaceNavigableMap<K,V>
-
tailMap
public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
- Specified by:
tailMapin interfaceNavigableMap<K,V>
-
-