Class ForwardingSortedMap.StandardKeySet

    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Removes all of the elements from this collection (optional operation).
      <? super K> comparator()
      Returns the comparator used to order the elements in this set, or null if this set uses the of its elements.
      boolean  o)
      Returns true if this collection contains the specified element.
      K first()
      Returns the first (lowest) element currently in this set.
      void <? super K> action)
      Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.
      <K> headSet​(K toElement)
      Returns a view of the portion of this set whose elements are strictly less than toElement.
      boolean isEmpty()
      Returns true if this collection contains no elements.
      <K> iterator()
      Returns an iterator over the elements contained in this collection.
      K last()
      Returns the last (highest) element currently in this set.
      boolean  o)
      Removes a single instance of the specified element from this collection, if it is present (optional operation).
      boolean <?> c)
      Removes from this set all of its elements that are contained in the specified collection (optional operation).
      boolean <?> c)
      Retains only the elements in this collection that are contained in the specified collection (optional operation).
      int size()
      Returns the number of elements in this collection.
      <K> subSet​(K fromElement, K toElement)
      Returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive.
      <K> tailSet​(K fromElement)
      Returns a view of the portion of this set whose elements are greater than or equal to fromElement.
      • Methods inherited from class java.util.

        ,
      • Methods inherited from class java.util.

        , , , , ,
      • Methods inherited from class java.lang.

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

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

      • Methods inherited from interface java.util.

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

    • Constructor Detail

      • StandardKeySet

        public StandardKeySet()
        Constructor for use by subclasses.
    • Method Detail

      • comparator

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

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

        The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

        Specified by:
         in interface <K>
        Parameters:
        fromElement - low endpoint (inclusive) of the returned set
        toElement - high endpoint (exclusive) of the returned set
        Returns:
        a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive
      • headSet

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

        The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

        Specified by:
         in interface <K>
        Parameters:
        toElement - high endpoint (exclusive) of the returned set
        Returns:
        a view of the portion of this set whose elements are strictly less than toElement
      • tailSet

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

        The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

        Specified by:
         in interface <K>
        Parameters:
        fromElement - low endpoint (inclusive) of the returned set
        Returns:
        a view of the portion of this set whose elements are greater than or equal to fromElement
      • first

        public K first()
        Description copied from interface: 
        Returns the first (lowest) element currently in this set.
        Specified by:
         in interface <K>
        Returns:
        the first (lowest) element currently in this set
      • last

        public K last()
        Description copied from interface: 
        Returns the last (highest) element currently in this set.
        Specified by:
         in interface <K>
        Returns:
        the last (highest) element currently in this set
      • iterator

        public <K> iterator()
        Description copied from class: 
        Returns an iterator over the elements contained in this collection.
        Specified by:
         in interface <K>
        Specified by:
         in interface <K>
        Specified by:
         in interface <K>
        Specified by:
         in class <K>
        Returns:
        an iterator over the elements contained in this collection
      • forEach

        public void forEach​(<? super K> action)
        Description copied from interface: 
        Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

        The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.

        Parameters:
        action - The action to be performed for each element
      • size

        public int size()
        Description copied from interface: 
        Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
        Specified by:
         in interface <K>
        Specified by:
         in interface <K>
        Specified by:
         in class <K>
        Returns:
        the number of elements in this collection
      • isEmpty

        public boolean isEmpty()
        Description copied from class: 
        Returns true if this collection contains no elements.
        Specified by:
         in interface <K>
        Specified by:
         in interface <K>
        Overrides:
         in class <K>
        Returns:
        true if this collection contains no elements
      • contains

        public boolean contains​( o)
        Description copied from class: 
        Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that Objects.equals(o, e).
        Specified by:
         in interface <K>
        Specified by:
         in interface <K>
        Overrides:
         in class <K>
        Parameters:
        o - element whose presence in this collection is to be tested
        Returns:
        true if this collection contains the specified element
      • remove

        public boolean remove​( o)
        Description copied from class: 
        Removes a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this collection contains one or more such elements. Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).
        Specified by:
         in interface <K>
        Specified by:
         in interface <K>
        Overrides:
         in class <K>
        Parameters:
        o - element to be removed from this collection, if present
        Returns:
        true if an element was removed as a result of this call
      • clear

        public void clear()
        Description copied from class: 
        Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
        Specified by:
         in interface <K>
        Specified by:
         in interface <K>
        Overrides:
         in class <K>
      • removeAll

        public boolean removeAll​(<?> c)
        Description copied from class: 
        Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.

        This implementation determines which is the smaller of this set and the specified collection, by invoking the size method on each. If this set has fewer elements, then the implementation iterates over this set, checking each element returned by the iterator in turn to see if it is contained in the specified collection. If it is so contained, it is removed from this set with the iterator's remove method. If the specified collection has fewer elements, then the implementation iterates over the specified collection, removing from this set each element returned by the iterator, using this set's remove method.

        Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method.

        Specified by:
         in interface <E>
        Specified by:
         in interface <E>
        Overrides:
         in class <E>
        Parameters:
        c - collection containing elements to be removed from this set
        Returns:
        true if this set changed as a result of the call
        See Also:
        ,
      • retainAll

        public boolean retainAll​(<?> c)
        Description copied from class: 
        Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.
        Specified by:
         in interface <E>
        Specified by:
         in interface <E>
        Overrides:
         in class <E>
        Parameters:
        c - collection containing elements to be retained in this collection
        Returns:
        true if this collection changed as a result of the call
        See Also:
        ,