Interface ReferenceSet<K>

All Superinterfaces:
Collection<K>, Iterable<K>, it.unimi.dsi.fastutil.objects.ObjectIterable<K>, it.unimi.dsi.fastutil.objects.ReferenceCollection<K>, Set<K>
All Known Subinterfaces:
ReferenceSortedSet<K>
All Known Implementing Classes:
AbstractReferenceSet, AbstractReferenceSortedSet, ReferenceArraySet, ReferenceLinkedOpenHashSet, ReferenceOpenHashBigSet, ReferenceOpenHashSet, ReferenceSets.EmptySet, ReferenceSets.Singleton, ReferenceSets.SynchronizedSet, ReferenceSets.UnmodifiableSet, ReferenceSortedSets.EmptySet, ReferenceSortedSets.Singleton, ReferenceSortedSets.SynchronizedSortedSet, ReferenceSortedSets.UnmodifiableSortedSet

public interface ReferenceSet<K> extends it.unimi.dsi.fastutil.objects.ReferenceCollection<K>, Set<K>
A type-specific Set; provides some additional methods that use polymorphism to avoid (un)boxing.

Additionally, this interface strengthens (again) iterator().

This interface specifies reference equality semantics (members will be compared equal with == instead of equals), which may result in breaks in contract if attempted to be used with non reference-equality semantics based Sets. For example, a aReferenceSet.equals(aObjectSet) may return different a different result then aObjectSet.equals(aReferenceSet), in violation of equals's contract requiring it being symmetric.

See Also:
  • Method Details

    • iterator

      it.unimi.dsi.fastutil.objects.ObjectIterator<K> iterator()
      Returns a type-specific iterator on the elements of this set.
      Specified by:
      iterator in interface Collection<K>
      Specified by:
      iterator in interface Iterable<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 Set<K>
      Returns:
      a type-specific iterator on the elements of this set.
    • spliterator

      default it.unimi.dsi.fastutil.objects.ObjectSpliterator<K> spliterator()
      Returns a type-specific spliterator on the elements of this set.

      Set spliterators must report at least Spliterator.DISTINCT.

      See Set.spliterator() for more documentation on the requirements of the returned 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>
      Specified by:
      spliterator in interface Set<K>
      Returns:
      Since:
      8.5.0
    • of

      static <K> ReferenceSet<K> of()
      Returns an immutable empty set.
      Returns:
      an immutable empty set.
    • of

      static <K> ReferenceSet<K> of(K e)
      Returns an immutable set with the element given.
      Parameters:
      e - an element.
      Returns:
      an immutable set containing e.
    • of

      static <K> ReferenceSet<K> of(K e0, K e1)
      Returns an immutable set with the elements given.
      Parameters:
      e0 - the first element.
      e1 - the second element.
      Returns:
      an immutable set containing e0 and e1.
      Throws:
      IllegalArgumentException - if there were duplicate entries.
    • of

      static <K> ReferenceSet<K> of(K e0, K e1, K e2)
      Returns an immutable set with the elements given.
      Parameters:
      e0 - the first element.
      e1 - the second element.
      e2 - the third element.
      Returns:
      an immutable set containing e0, e1, and e2.
      Throws:
      IllegalArgumentException - if there were duplicate entries.
    • of

      @SafeVarargs static <K> ReferenceSet<K> of(K... a)
      Returns an immutable list with the elements given.
      Parameters:
      a - the list of elements that will be in the final set.
      Returns:
      an immutable set containing the elements in a.
      Throws:
      IllegalArgumentException - if there are any duplicate entries.