Package it.unimi.dsi.fastutil.objects
Class ReferenceSets.Singleton<K>
java.lang.Object
java.util.AbstractCollection<K>
it.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>
it.unimi.dsi.fastutil.objects.AbstractReferenceSet<K>
it.unimi.dsi.fastutil.objects.ReferenceSets.Singleton<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 booleanaddAll(java.util.Collection<? extends K> c)java.lang.Objectclone()booleancontains(java.lang.Object k)voidforEach(java.util.function.Consumer<? super K> action)ObjectListIterator<K>iterator()Returns a type-specific iterator on the elements of this collection.booleanremove(java.lang.Object k)booleanremoveAll(java.util.Collection<?> c)booleanremoveIf(java.util.function.Predicate<? super K> filter)booleanretainAll(java.util.Collection<?> c)intsize()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, hashCodeMethods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection
toStringMethods inherited from class java.util.AbstractCollection
add, clear, containsAll, isEmpty, toArrayMethods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.Set
add, clear, containsAll, isEmpty, toArray
-
Method Details
-
contains
public boolean contains(java.lang.Object k) -
remove
public boolean remove(java.lang.Object k) -
iterator
Description copied from interface:ReferenceCollectionReturns a type-specific iterator on the elements of this collection.- Specified by:
iteratorin interfacejava.util.Collection<K>- Specified by:
iteratorin interfacejava.lang.Iterable<K>- Specified by:
iteratorin interfaceObjectIterable<K>- Specified by:
iteratorin interfaceReferenceCollection<K>- Specified by:
iteratorin interfaceReferenceSet<K>- Specified by:
iteratorin interfacejava.util.Set<K>- Specified by:
iteratorin classAbstractReferenceSet<K>- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
spliterator
Description copied from interface:ReferenceSetReturns 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:
spliteratorin interfacejava.util.Collection<K>- Specified by:
spliteratorin interfacejava.lang.Iterable<K>- Specified by:
spliteratorin interfaceObjectIterable<K>- Specified by:
spliteratorin interfaceReferenceCollection<K>- Specified by:
spliteratorin interfaceReferenceSet<K>- Specified by:
spliteratorin interfacejava.util.Set<K>- Returns:
- a type-specific spliterator on the elements of this collection.
-
size
public int size() -
toArray
public java.lang.Object[] toArray() -
forEach
- Specified by:
forEachin interfacejava.lang.Iterable<K>
-
addAll
-
removeAll
public boolean removeAll(java.util.Collection<?> c) -
retainAll
public boolean retainAll(java.util.Collection<?> c) -
removeIf
- Specified by:
removeIfin interfacejava.util.Collection<K>
-
clone
public java.lang.Object clone()
-