Interface ReferenceSet<K>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      ObjectIterator<K> iterator()
      Returns a type-specific iterator on the elements of this set.
      static <K> ReferenceSet<K> of()
      Returns an immutable empty set.
      static <K> ReferenceSet<K> of​(K e)
      Returns an immutable set with the element given.
      static <K> ReferenceSet<K> of​(K... a)
      Returns an immutable list with the elements given.
      static <K> ReferenceSet<K> of​(K e0, K e1)
      Returns an immutable set with the elements given.
      static <K> ReferenceSet<K> of​(K e0, K e1, K e2)
      Returns an immutable set with the elements given.
      default ObjectSpliterator<K> spliterator()
      Returns a type-specific spliterator on the elements of this set.
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
    • Method Detail

      • iterator

        ObjectIterator<K> iterator()
        Returns a type-specific iterator on the elements of this set.
        Specified by:
        iterator in interface java.util.Collection<K>
        Specified by:
        iterator in interface java.lang.Iterable<K>
        Specified by:
        iterator in interface ObjectIterable<K>
        Specified by:
        iterator in interface ReferenceCollection<K>
        Specified by:
        iterator in interface java.util.Set<K>
        Returns:
        a type-specific iterator on the elements of this set.
        See Also:
        Iterable.iterator()
        API Notes:
        This specification strengthens the one given in Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Set.

        Also, this is generally the only iterator method subclasses should override.

      • spliterator

        default 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 java.util.Collection<K>
        Specified by:
        spliterator in interface java.lang.Iterable<K>
        Specified by:
        spliterator in interface ObjectIterable<K>
        Specified by:
        spliterator in interface ReferenceCollection<K>
        Specified by:
        spliterator in interface java.util.Set<K>
        Returns:
        a type-specific spliterator on the elements of this collection.
        Since:
        8.5.0
        API Notes:
        This specification strengthens the one given in Collection.spliterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Set.

        Also, this is generally the only spliterator method subclasses should override.

        Implementation Specification:
        The default implementation returns a late-binding spliterator (see Spliterator for documentation on what binding policies mean) that wraps this instance's type specific iterator().

        Additionally, it reports Spliterator.SIZED and Spliterator.DISTINCT.

        Implementation Notes:
        As this default implementation wraps the iterator, and Iterator is an inherently linear API, the returned spliterator will yield limited performance gains when run in parallel contexts, as the returned spliterator's trySplit() will have linear runtime.
      • 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:
        java.lang.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:
        java.lang.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:
        java.lang.IllegalArgumentException - if there are any duplicate entries.