Class ForwardingSortedMap.StandardKeySet

    • Constructor Detail

      • StandardKeySet

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

      • subSet

        public SortedSet<K> subSet​(K fromElement,
                                   K toElement)
        Description copied from interface: java.util.SortedSet
        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:
        subSet in interface SortedSet<K extends @Nullable Object>
        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 SortedSet<K> headSet​(K toElement)
        Description copied from interface: java.util.SortedSet
        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:
        headSet in interface SortedSet<K extends @Nullable Object>
        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 SortedSet<K> tailSet​(K fromElement)
        Description copied from interface: java.util.SortedSet
        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:
        tailSet in interface SortedSet<K extends @Nullable Object>
        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: java.util.SortedSet
        Returns the first (lowest) element currently in this set.
        Specified by:
        first in interface SortedSet<K extends @Nullable Object>
        Returns:
        the first (lowest) element currently in this set
      • last

        public K last()
        Description copied from interface: java.util.SortedSet
        Returns the last (highest) element currently in this set.
        Specified by:
        last in interface SortedSet<K extends @Nullable Object>
        Returns:
        the last (highest) element currently in this set
      • remove

        public boolean remove​(@CheckForNull
                              Object o)
        Description copied from class: java.util.AbstractCollection
        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:
        remove in interface Collection<K extends @Nullable Object>
        Specified by:
        remove in interface Set<K extends @Nullable Object>
        Overrides:
        remove in class AbstractCollection<K extends @Nullable Object>
        Parameters:
        o - element to be removed from this collection, if present
        Returns:
        true if an element was removed as a result of this call
      • removeAll

        public boolean removeAll​(Collection<?> c)
        Description copied from class: java.util.AbstractSet
        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:
        removeAll in interface Collection<E extends @Nullable Object>
        Specified by:
        removeAll in interface Set<E extends @Nullable Object>
        Overrides:
        removeAll in class AbstractSet<E extends @Nullable Object>
        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:
        AbstractCollection.remove(Object), AbstractCollection.contains(Object)