Class ForwardingNavigableMap.StandardDescendingMap

    • Constructor Summary

      Constructors 
      Constructor Description
      StandardDescendingMap()
      Constructor for use by subclasses.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <K,​V> ceilingEntry​(K key)
      Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
      K ceilingKey​(K key)
      Returns the least key greater than or equal to the given key, or null if there is no such key.
      <? super K> comparator()
      Returns the comparator used to order the keys in this map, or null if this map uses the of its keys.
      protected <K,​V> delegate()
      Returns the backing delegate instance that methods are forwarded to.
      <K> descendingKeySet()
      Returns a reverse order view of the keys contained in this map.
      <K,​V> descendingMap()
      Returns a reverse order view of the mappings contained in this map.
      protected <<K,​V>> entryIterator()  
      <<K,​V>> entrySet()
      Returns a view of the mappings contained in this map.
      <K,​V> firstEntry()
      Returns a key-value mapping associated with the least key in this map, or null if the map is empty.
      K firstKey()
      Returns the first (lowest) key currently in this map.
      <K,​V> floorEntry​(K key)
      Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
      K floorKey​(K key)
      Returns the greatest key less than or equal to the given key, or null if there is no such key.
      <K,​V> headMap​(K toKey)
      Returns a view of the portion of this map whose keys are strictly less than toKey.
      <K,​V> headMap​(K toKey, boolean inclusive)
      Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey.
      <K,​V> higherEntry​(K key)
      Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
      K higherKey​(K key)
      Returns the least key strictly greater than the given key, or null if there is no such key.
      <K> keySet()
      Returns a view of the keys contained in this map.
      <K,​V> lastEntry()
      Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
      K lastKey()
      Returns the last (highest) key currently in this map.
      <K,​V> lowerEntry​(K key)
      Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
      K lowerKey​(K key)
      Returns the greatest key strictly less than the given key, or null if there is no such key.
      <K> navigableKeySet()
      Returns a view of the keys contained in this map.
      <K,​V> pollFirstEntry()
      Removes and returns a key-value mapping associated with the least key in this map, or null if the map is empty.
      <K,​V> pollLastEntry()
      Removes and returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
      void <? super K,​? super V,​? extends V> function)
      Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
      <K,​V> subMap​(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
      Returns a view of the portion of this map whose keys range from fromKey to toKey.
      <K,​V> subMap​(K fromKey, K toKey)
      Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
      <K,​V> tailMap​(K fromKey)
      Returns a view of the portion of this map whose keys are greater than or equal to fromKey.
      <K,​V> tailMap​(K fromKey, boolean inclusive)
      Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey.
      toString()
      Returns the string representation generated by the delegate's toString method.
      <V> values()
      Returns a view of the values contained in this map.
      • Methods inherited from class java.lang.

        , , , , , , ,
      • Methods inherited from interface java.util.

        , , , , , , , , , , , , , , , , , , , ,
    • Method Detail

      • replaceAll

        public void <? super K,​? super V,​? extends V> function)
        Description copied from interface: 
        Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception. Exceptions thrown by the function are relayed to the caller.
        Parameters:
        function - the function to apply to each entry
      • delegate

        protected final <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 as ForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.
        Specified by:
        delegate in class ForwardingMap<K,​V>
      • comparator

        public <? super K> comparator()
        Description copied from interface: 
        Returns the comparator used to order the keys in this map, or null if this map uses the of its keys.
        Specified by:
         in interface <K,​V>
        Returns:
        the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys
      • firstKey

        public K firstKey()
        Description copied from interface: 
        Returns the first (lowest) key currently in this map.
        Specified by:
         in interface <K,​V>
        Returns:
        the first (lowest) key currently in this map
      • lastKey

        public K lastKey()
        Description copied from interface: 
        Returns the last (highest) key currently in this map.
        Specified by:
         in interface <K,​V>
        Returns:
        the last (highest) key currently in this map
      • lowerEntry

        public <K,​V> lowerEntry​(K key)
        Description copied from interface: 
        Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the greatest key less than key, or null if there is no such key
      • lowerKey

        public K lowerKey​(K key)
        Description copied from interface: 
        Returns the greatest key strictly less than the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        the greatest key less than key, or null if there is no such key
      • floorEntry

        public <K,​V> floorEntry​(K key)
        Description copied from interface: 
        Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the greatest key less than or equal to key, or null if there is no such key
      • floorKey

        public K floorKey​(K key)
        Description copied from interface: 
        Returns the greatest key less than or equal to the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        the greatest key less than or equal to key, or null if there is no such key
      • ceilingEntry

        public <K,​V> ceilingEntry​(K key)
        Description copied from interface: 
        Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the least key greater than or equal to key, or null if there is no such key
      • ceilingKey

        public K ceilingKey​(K key)
        Description copied from interface: 
        Returns the least key greater than or equal to the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        the least key greater than or equal to key, or null if there is no such key
      • higherEntry

        public <K,​V> higherEntry​(K key)
        Description copied from interface: 
        Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        an entry with the least key greater than key, or null if there is no such key
      • higherKey

        public K higherKey​(K key)
        Description copied from interface: 
        Returns the least key strictly greater than the given key, or null if there is no such key.
        Specified by:
         in interface <K,​V>
        Parameters:
        key - the key
        Returns:
        the least key greater than key, or null if there is no such key
      • firstEntry

        public <K,​V> firstEntry()
        Description copied from interface: 
        Returns a key-value mapping associated with the least key in this map, or null if the map is empty.
        Specified by:
         in interface <K,​V>
        Returns:
        an entry with the least key, or null if this map is empty
      • lastEntry

        public <K,​V> lastEntry()
        Description copied from interface: 
        Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
        Specified by:
         in interface <K,​V>
        Returns:
        an entry with the greatest key, or null if this map is empty
      • pollFirstEntry

        public <K,​V> pollFirstEntry()
        Description copied from interface: 
        Removes and returns a key-value mapping associated with the least key in this map, or null if the map is empty.
        Specified by:
         in interface <K,​V>
        Returns:
        the removed first entry of this map, or null if this map is empty
      • pollLastEntry

        public <K,​V> pollLastEntry()
        Description copied from interface: 
        Removes and returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
        Specified by:
         in interface <K,​V>
        Returns:
        the removed last entry of this map, or null if this map is empty
      • descendingMap

        public <K,​V> descendingMap()
        Description copied from interface: 
        Returns a reverse order view of the mappings contained in this map. The descending map is backed by this map, so changes to the map are reflected in the descending map, and vice-versa. If either map is modified while an iteration over a collection view of either map is in progress (except through the iterator's own remove operation), the results of the iteration are undefined.

        The returned map has an ordering equivalent to (comparator()). The expression m.descendingMap().descendingMap() returns a view of m essentially equivalent to m.

        Specified by:
         in interface <K,​V>
        Returns:
        a reverse order view of this map
      • entrySet

        public <<K,​V>> entrySet()
        Description copied from interface: 
        Returns a view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
        Specified by:
         in interface <K,​V>
        Specified by:
         in interface <K,​V>
        Overrides:
        entrySet in class ForwardingMap<K,​V>
        Returns:
        a set view of the mappings contained in this map
      • keySet

        public <K> keySet()
        Description copied from interface: 
        Returns a view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
        Specified by:
         in interface <K,​V>
        Specified by:
         in interface <K,​V>
        Overrides:
        keySet in class ForwardingMap<K,​V>
        Returns:
        a set view of the keys contained in this map
      • navigableKeySet

        public <K> navigableKeySet()
        Description copied from interface: 
        Returns a view of the keys contained in this map. The set's iterator returns the keys in ascending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
        Specified by:
         in interface <K,​V>
        Returns:
        a navigable set view of the keys in this map
      • descendingKeySet

        public <K> descendingKeySet()
        Description copied from interface: 
        Returns a reverse order view of the keys contained in this map. The set's iterator returns the keys in descending order. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
        Specified by:
         in interface <K,​V>
        Returns:
        a reverse order navigable set view of the keys in this map
      • subMap

        public <K,​V> subMap​(K fromKey,
                                              boolean fromInclusive,
                                              K toKey,
                                              boolean toInclusive)
        Description copied from interface: 
        Returns a view of the portion of this map whose keys range from fromKey to toKey. If fromKey and toKey are equal, the returned map is empty unless fromInclusive and toInclusive are both true. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside of its range, or to construct a submap either of whose endpoints lie outside its range.

        Specified by:
         in interface <K,​V>
        Parameters:
        fromKey - low endpoint of the keys in the returned map
        fromInclusive - true if the low endpoint is to be included in the returned view
        toKey - high endpoint of the keys in the returned map
        toInclusive - true if the high endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys range from fromKey to toKey
      • subMap

        public <K,​V> subMap​(K fromKey,
                                           K toKey)
        Description copied from interface: 
        Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. (If fromKey and toKey are equal, the returned map is empty.) The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Equivalent to subMap(fromKey, true, toKey, false).

        Specified by:
         in interface <K,​V>
        Specified by:
         in interface <K,​V>
        Parameters:
        fromKey - low endpoint (inclusive) of the keys in the returned map
        toKey - high endpoint (exclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive
      • headMap

        public <K,​V> headMap​(K toKey,
                                               boolean inclusive)
        Description copied from interface: 
        Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Specified by:
         in interface <K,​V>
        Parameters:
        toKey - high endpoint of the keys in the returned map
        inclusive - true if the high endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey
      • headMap

        public <K,​V> headMap​(K toKey)
        Description copied from interface: 
        Returns a view of the portion of this map whose keys are strictly less than toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Equivalent to headMap(toKey, false).

        Specified by:
         in interface <K,​V>
        Specified by:
         in interface <K,​V>
        Parameters:
        toKey - high endpoint (exclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys are strictly less than toKey
      • tailMap

        public <K,​V> tailMap​(K fromKey,
                                               boolean inclusive)
        Description copied from interface: 
        Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Specified by:
         in interface <K,​V>
        Parameters:
        fromKey - low endpoint of the keys in the returned map
        inclusive - true if the low endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey
      • tailMap

        public <K,​V> tailMap​(K fromKey)
        Description copied from interface: 
        Returns a view of the portion of this map whose keys are greater than or equal to fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Equivalent to tailMap(fromKey, true).

        Specified by:
         in interface <K,​V>
        Specified by:
         in interface <K,​V>
        Parameters:
        fromKey - low endpoint (inclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys are greater than or equal to fromKey
      • values

        public <V> values()
        Description copied from interface: 
        Returns a view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
        Specified by:
         in interface <K,​V>
        Specified by:
         in interface <K,​V>
        Overrides:
        values in class ForwardingMap<K,​V>
        Returns:
        a collection view of the values contained in this map
      • toString

        public  toString()
        Description copied from class: ForwardingObject
        Returns the string representation generated by the delegate's toString method.
        Overrides:
        toString in class ForwardingObject
        Returns:
        a string representation of the object.