Class ReferenceSortedSets.UnmodifiableSortedSet<K>

java.lang.Object
it.unimi.dsi.fastutil.objects.ReferenceSets.UnmodifiableSet<K>
it.unimi.dsi.fastutil.objects.ReferenceSortedSets.UnmodifiableSortedSet<K>
All Implemented Interfaces:
it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterable<K>, it.unimi.dsi.fastutil.objects.ObjectIterable<K>, it.unimi.dsi.fastutil.objects.ReferenceCollection<K>, ReferenceSet<K>, ReferenceSortedSet<K>, Serializable, Iterable<K>, Collection<K>, SequencedCollection<K>, SequencedSet<K>, Set<K>, SortedSet<K>
Enclosing class:
ReferenceSortedSets

public static class ReferenceSortedSets.UnmodifiableSortedSet<K> extends ReferenceSets.UnmodifiableSet<K> implements ReferenceSortedSet<K>, Serializable
An unmodifiable wrapper class for sorted sets.
See Also:
  • Field Details

    • sortedSet

      protected final ReferenceSortedSet<K> sortedSet
    • collection

      protected final it.unimi.dsi.fastutil.objects.ReferenceCollection<? extends K> collection
  • Constructor Details

  • Method Details

    • comparator

      public Comparator<? super K> comparator()
      Specified by:
      comparator in interface SortedSet<K>
    • subSet

      public ReferenceSortedSet<K> subSet(K from, K to)
      Description copied from interface: ReferenceSortedSet
      Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive.
      Specified by:
      subSet in interface ReferenceSortedSet<K>
      Specified by:
      subSet in interface SortedSet<K>
      See Also:
    • headSet

      public ReferenceSortedSet<K> headSet(K to)
      Description copied from interface: ReferenceSortedSet
      Returns a view of the portion of this sorted set whose elements are strictly less than toElement.
      Specified by:
      headSet in interface ReferenceSortedSet<K>
      Specified by:
      headSet in interface SortedSet<K>
      See Also:
    • tailSet

      public ReferenceSortedSet<K> tailSet(K from)
      Description copied from interface: ReferenceSortedSet
      Returns a view of the portion of this sorted set whose elements are greater than or equal to fromElement.
      Specified by:
      tailSet in interface ReferenceSortedSet<K>
      Specified by:
      tailSet in interface SortedSet<K>
      See Also:
    • iterator

      public it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<K> iterator()
      Description copied from interface: ReferenceSortedSet
      Returns a type-specific BidirectionalIterator on the elements in this set.

      This method returns a parameterised bidirectional iterator. The iterator can be moreover safely cast to a type-specific iterator.

      Specified by:
      iterator in interface Collection<K>
      Specified by:
      iterator in interface Iterable<K>
      Specified by:
      iterator in interface it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterable<K>
      Specified by:
      iterator in interface it.unimi.dsi.fastutil.objects.ObjectIterable<K>
      Specified by:
      iterator in interface it.unimi.dsi.fastutil.objects.ReferenceCollection<K>
      Specified by:
      iterator in interface ReferenceSet<K>
      Specified by:
      iterator in interface ReferenceSortedSet<K>
      Specified by:
      iterator in interface Set<K>
      Returns:
      a bidirectional iterator on the element in this set.
    • iterator

      public it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<K> iterator(K from)
      Description copied from interface: ReferenceSortedSet
      Returns a type-specific BidirectionalIterator on the elements in this set, starting from a given element of the domain (optional operation).

      This method returns a type-specific bidirectional iterator with given starting point. The starting point is any element comparable to the elements of this set (even if it does not actually belong to the set). The next element of the returned iterator is the least element of the set that is greater than the starting point (if there are no elements greater than the starting point, hasNext() will return false). The previous element of the returned iterator is the greatest element of the set that is smaller than or equal to the starting point (if there are no elements smaller than or equal to the starting point, hasPrevious() will return false).

      Note that passing the last element of the set as starting point and calling previous() you can traverse the entire set in reverse order.

      Specified by:
      iterator in interface ReferenceSortedSet<K>
      Parameters:
      from - an element to start from.
      Returns:
      a bidirectional iterator on the element in this set, starting at the given element.
    • first

      public K first()
      Specified by:
      first in interface SortedSet<K>
    • last

      public K last()
      Specified by:
      last in interface SortedSet<K>
    • add

      public boolean add(K arg0)
      Specified by:
      add in interface Collection<K>
    • size

      public int size()
      Specified by:
      size in interface Collection<K>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<K>
    • contains

      public boolean contains(Object arg0)
      Specified by:
      contains in interface Collection<K>
    • spliterator

      public it.unimi.dsi.fastutil.objects.ObjectSpliterator<K> spliterator()
      Specified by:
      spliterator in interface Collection<K>
      Specified by:
      spliterator in interface Iterable<K>
      Specified by:
      spliterator in interface it.unimi.dsi.fastutil.objects.ObjectIterable<K>
      Specified by:
      spliterator in interface it.unimi.dsi.fastutil.objects.ReferenceCollection<K>
    • stream

      public Stream<K> stream()
      Specified by:
      stream in interface Collection<K>
    • parallelStream

      public Stream<K> parallelStream()
      Specified by:
      parallelStream in interface Collection<K>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<K>
    • toArray

      public <T> T[] toArray(T[] arg0)
      Specified by:
      toArray in interface Collection<K>
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<K>
    • forEach

      public void forEach(Consumer<? super K> arg0)
      Specified by:
      forEach in interface Iterable<K>
    • containsAll

      public boolean containsAll(Collection<?> arg0)
      Specified by:
      containsAll in interface Collection<K>
    • addAll

      public boolean addAll(Collection<? extends K> arg0)
      Specified by:
      addAll in interface Collection<K>
    • removeAll

      public boolean removeAll(Collection<?> arg0)
      Specified by:
      removeAll in interface Collection<K>
    • retainAll

      public boolean retainAll(Collection<?> arg0)
      Specified by:
      retainAll in interface Collection<K>
    • removeIf

      public boolean removeIf(Predicate<? super K> arg0)
      Specified by:
      removeIf in interface Collection<K>
    • toString

      public String toString()
      Overrides:
      toString in class Object