Class ForwardingNavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>

  • All Implemented Interfaces:
    java.util.Map<K,​V>, java.util.NavigableMap<K,​V>, java.util.SortedMap<K,​V>

    @GwtIncompatible
    public abstract class ForwardingNavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
    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, 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 ForwardingNavigableMap.

    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 the Map 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
    Author:
    Louis Wasserman
    • Method Detail

      • delegate

        protected abstract java.util.NavigableMap<K,​Vdelegate()
        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 as ForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.
        Specified by:
        delegate in class ForwardingSortedMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • lowerEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VlowerEntry​(K key)
        Specified by:
        lowerEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardLowerEntry

        @CheckForNull
        protected java.util.Map.Entry<K,​VstandardLowerEntry​(K key)
        A sensible definition of lowerEntry(K) in terms of the lastEntry() of headMap(Object, boolean). If you override headMap, you may wish to override lowerEntry to forward to this implementation.
      • lowerKey

        @CheckForNull
        public K lowerKey​(K key)
        Specified by:
        lowerKey in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardLowerKey

        @CheckForNull
        protected K standardLowerKey​(K key)
        A sensible definition of lowerKey(K) in terms of lowerEntry. If you override lowerEntry(K), you may wish to override lowerKey to forward to this implementation.
      • floorEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VfloorEntry​(K key)
        Specified by:
        floorEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardFloorEntry

        @CheckForNull
        protected java.util.Map.Entry<K,​VstandardFloorEntry​(K key)
        A sensible definition of floorEntry(K) in terms of the lastEntry() of headMap(Object, boolean). If you override headMap, you may wish to override floorEntry to forward to this implementation.
      • floorKey

        @CheckForNull
        public K floorKey​(K key)
        Specified by:
        floorKey in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardFloorKey

        @CheckForNull
        protected K standardFloorKey​(K key)
        A sensible definition of floorKey(K) in terms of floorEntry. If you override floorEntry, you may wish to override floorKey to forward to this implementation.
      • ceilingEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VceilingEntry​(K key)
        Specified by:
        ceilingEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • ceilingKey

        @CheckForNull
        public K ceilingKey​(K key)
        Specified by:
        ceilingKey in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardCeilingKey

        @CheckForNull
        protected K standardCeilingKey​(K key)
        A sensible definition of ceilingKey(K) in terms of ceilingEntry. If you override ceilingEntry, you may wish to override ceilingKey to forward to this implementation.
      • higherEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VhigherEntry​(K key)
        Specified by:
        higherEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardHigherEntry

        @CheckForNull
        protected java.util.Map.Entry<K,​VstandardHigherEntry​(K key)
        A sensible definition of higherEntry(K) in terms of the firstEntry() of tailMap(Object, boolean). If you override tailMap, you may wish to override higherEntry to forward to this implementation.
      • higherKey

        @CheckForNull
        public K higherKey​(K key)
        Specified by:
        higherKey in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardHigherKey

        @CheckForNull
        protected K standardHigherKey​(K key)
        A sensible definition of higherKey(K) in terms of higherEntry. If you override higherEntry, you may wish to override higherKey to forward to this implementation.
      • firstEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VfirstEntry()
        Specified by:
        firstEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardFirstEntry

        @CheckForNull
        protected java.util.Map.Entry<K,​VstandardFirstEntry()
        A sensible definition of firstEntry() in terms of the iterator() of ForwardingMap.entrySet(). If you override entrySet, you may wish to override firstEntry to forward to this implementation.
      • lastEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VlastEntry()
        Specified by:
        lastEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • pollFirstEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VpollFirstEntry()
        Specified by:
        pollFirstEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardPollFirstEntry

        @CheckForNull
        protected java.util.Map.Entry<K,​VstandardPollFirstEntry()
        A sensible definition of pollFirstEntry() in terms of the iterator of entrySet. If you override entrySet, you may wish to override pollFirstEntry to forward to this implementation.
      • pollLastEntry

        @CheckForNull
        public java.util.Map.Entry<K,​VpollLastEntry()
        Specified by:
        pollLastEntry in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • standardPollLastEntry

        @CheckForNull
        protected java.util.Map.Entry<K,​VstandardPollLastEntry()
        A sensible definition of pollFirstEntry() in terms of the iterator of the entrySet of descendingMap. If you override descendingMap, you may wish to override pollFirstEntry to forward to this implementation.
      • descendingMap

        public java.util.NavigableMap<K,​VdescendingMap()
        Specified by:
        descendingMap in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • navigableKeySet

        public java.util.NavigableSet<KnavigableKeySet()
        Specified by:
        navigableKeySet in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • descendingKeySet

        public java.util.NavigableSet<KdescendingKeySet()
        Specified by:
        descendingKeySet in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • subMap

        public java.util.NavigableMap<K,​VsubMap​(K fromKey,
                                                        boolean fromInclusive,
                                                        K toKey,
                                                        boolean toInclusive)
        Specified by:
        subMap in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • headMap

        public java.util.NavigableMap<K,​VheadMap​(K toKey,
                                                         boolean inclusive)
        Specified by:
        headMap in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>
      • tailMap

        public java.util.NavigableMap<K,​VtailMap​(K fromKey,
                                                         boolean inclusive)
        Specified by:
        tailMap in interface java.util.NavigableMap<K extends @Nullable java.lang.Object,​V extends @Nullable java.lang.Object>