Package it.unimi.dsi.fastutil.objects
Class ObjectSets.Singleton<K>
- java.lang.Object
-
- java.util.AbstractCollection<K>
-
- it.unimi.dsi.fastutil.objects.AbstractObjectCollection<K>
-
- it.unimi.dsi.fastutil.objects.AbstractObjectSet<K>
-
- it.unimi.dsi.fastutil.objects.ObjectSets.Singleton<K>
-
- All Implemented Interfaces:
ObjectCollection<K>
,ObjectIterable<K>
,ObjectSet<K>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<K>
,java.util.Collection<K>
,java.util.Set<K>
- Direct Known Subclasses:
ObjectSortedSets.Singleton
- Enclosing class:
- ObjectSets
public static class ObjectSets.Singleton<K> extends AbstractObjectSet<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
All Methods Instance Methods Concrete Methods 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.AbstractObjectSet
equals, hashCode
-
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
toString
-
-
-
-
Method Detail
-
contains
public boolean contains(java.lang.Object k)
-
remove
public boolean remove(java.lang.Object k)
-
iterator
public ObjectListIterator<K> iterator()
Description copied from interface:ObjectCollection
Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfacejava.util.Collection<K>
- Specified by:
iterator
in interfacejava.lang.Iterable<K>
- Specified by:
iterator
in interfaceObjectCollection<K>
- Specified by:
iterator
in interfaceObjectIterable<K>
- Specified by:
iterator
in interfaceObjectSet<K>
- Specified by:
iterator
in interfacejava.util.Set<K>
- Specified by:
iterator
in classAbstractObjectSet<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:ObjectSet
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 interfacejava.util.Collection<K>
- Specified by:
spliterator
in interfacejava.lang.Iterable<K>
- Specified by:
spliterator
in interfaceObjectCollection<K>
- Specified by:
spliterator
in interfaceObjectIterable<K>
- Specified by:
spliterator
in interfaceObjectSet<K>
- Specified by:
spliterator
in 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
public void forEach(java.util.function.Consumer<? super K> action)
- Specified by:
forEach
in interfacejava.lang.Iterable<K>
-
addAll
public boolean addAll(java.util.Collection<? extends K> c)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
removeIf
public boolean removeIf(java.util.function.Predicate<? super K> filter)
- Specified by:
removeIf
in interfacejava.util.Collection<K>
-
clone
public java.lang.Object clone()
-
-