Class ReferenceSets.Singleton<K>

java.lang.Object
java.util.AbstractCollection<K>
All Implemented Interfaces:
ObjectIterable<K>, ReferenceCollection<K>, ReferenceSet<K>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<K>, java.util.Collection<K>, java.util.Set<K>
Direct Known Subclasses:
ReferenceSortedSets.Singleton
Enclosing class:
ReferenceSets

public static class ReferenceSets.Singleton<K>
extends AbstractReferenceSet<K>
implements java.io.Serializable, java.lang.Cloneable
An immutable class representing a type-specific singleton set.

This class may be useful to implement your own in case you subclass a type-specific set.

See Also:
Serialized Form
  • Method Summary

    Modifier and Type Method Description
    boolean addAll​(java.util.Collection<? extends K> c)  
    java.lang.Object clone()  
    boolean contains​(java.lang.Object k)  
    void forEach​(java.util.function.Consumer<? super K> action)  
    ObjectListIterator<K> iterator()
    Returns a type-specific iterator on the elements of this collection.
    boolean remove​(java.lang.Object k)  
    boolean removeAll​(java.util.Collection<?> c)  
    boolean removeIf​(java.util.function.Predicate<? super K> filter)  
    boolean retainAll​(java.util.Collection<?> c)  
    int size()  
    ObjectSpliterator<K> spliterator()
    Returns a type-specific spliterator on the elements of this set.
    java.lang.Object[] toArray()  

    Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceSet

    equals, hashCode

    Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection

    toString

    Methods inherited from class java.util.AbstractCollection

    add, clear, containsAll, isEmpty, toArray

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, stream, toArray

    Methods inherited from interface java.util.Set

    add, clear, containsAll, isEmpty, toArray
  • Method Details

    • contains

      public boolean contains​(java.lang.Object k)
      Specified by:
      contains in interface java.util.Collection<K>
      Specified by:
      contains in interface java.util.Set<K>
      Overrides:
      contains in class java.util.AbstractCollection<K>
    • remove

      public boolean remove​(java.lang.Object k)
      Specified by:
      remove in interface java.util.Collection<K>
      Specified by:
      remove in interface java.util.Set<K>
      Overrides:
      remove in class java.util.AbstractCollection<K>
    • iterator

      public ObjectListIterator<K> iterator()
      Description copied from interface: ReferenceCollection
      Returns a type-specific iterator on the elements of this collection.
      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 ReferenceSet<K>
      Specified by:
      iterator in interface java.util.Set<K>
      Specified by:
      iterator in class AbstractReferenceSet<K>
      Returns:
      a type-specific iterator on the elements of this collection.
      See Also:
      Iterable.iterator()
    • spliterator

      public ObjectSpliterator<K> spliterator()
      Description copied from interface: ReferenceSet
      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 ReferenceSet<K>
      Specified by:
      spliterator in interface java.util.Set<K>
      Returns:
      a type-specific spliterator on the elements of this collection.
    • size

      public int size()
      Specified by:
      size in interface java.util.Collection<K>
      Specified by:
      size in interface java.util.Set<K>
      Specified by:
      size in class java.util.AbstractCollection<K>
    • toArray

      public java.lang.Object[] toArray()
      Specified by:
      toArray in interface java.util.Collection<K>
      Specified by:
      toArray in interface java.util.Set<K>
      Overrides:
      toArray in class java.util.AbstractCollection<K>
    • forEach

      public void forEach​(java.util.function.Consumer<? super K> action)
      Specified by:
      forEach in interface java.lang.Iterable<K>
    • addAll

      public boolean addAll​(java.util.Collection<? extends K> c)
      Specified by:
      addAll in interface java.util.Collection<K>
      Specified by:
      addAll in interface java.util.Set<K>
      Overrides:
      addAll in class java.util.AbstractCollection<K>
    • removeAll

      public boolean removeAll​(java.util.Collection<?> c)
      Specified by:
      removeAll in interface java.util.Collection<K>
      Specified by:
      removeAll in interface java.util.Set<K>
      Overrides:
      removeAll in class java.util.AbstractCollection<K>
    • retainAll

      public boolean retainAll​(java.util.Collection<?> c)
      Specified by:
      retainAll in interface java.util.Collection<K>
      Specified by:
      retainAll in interface java.util.Set<K>
      Overrides:
      retainAll in class java.util.AbstractCollection<K>
    • removeIf

      public boolean removeIf​(java.util.function.Predicate<? super K> filter)
      Specified by:
      removeIf in interface java.util.Collection<K>
    • clone

      public java.lang.Object clone()