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>
,Serializable
,Cloneable
,Iterable<K>
,Collection<K>
,Set<K>
- Direct Known Subclasses:
ObjectSortedSets.Singleton
- Enclosing class:
- ObjectSets
public static class ObjectSets.Singleton<K> extends AbstractObjectSet<K> implements Serializable, 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(Collection<? extends K> c)
Object
clone()
boolean
contains(Object k)
ObjectListIterator<K>
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
remove(Object k)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
-
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet
equals, hashCode
-
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
toString
-
Methods inherited from class java.util.AbstractCollection
add, clear, containsAll, isEmpty, toArray, toArray
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
add, clear, containsAll, isEmpty, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
contains
public boolean contains(Object k)
- Specified by:
contains
in interfaceCollection<K>
- Specified by:
contains
in interfaceSet<K>
- Overrides:
contains
in classAbstractCollection<K>
-
remove
public boolean remove(Object k)
- Specified by:
remove
in interfaceCollection<K>
- Specified by:
remove
in interfaceSet<K>
- Overrides:
remove
in classAbstractCollection<K>
-
iterator
public ObjectListIterator<K> iterator()
Description copied from interface:ObjectCollection
Returns a type-specific iterator on the elements of this collection.Note that 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 extendsCollection
.- Specified by:
iterator
in interfaceCollection<K>
- Specified by:
iterator
in interfaceIterable<K>
- Specified by:
iterator
in interfaceObjectCollection<K>
- Specified by:
iterator
in interfaceObjectIterable<K>
- Specified by:
iterator
in interfaceObjectSet<K>
- Specified by:
iterator
in interfaceSet<K>
- Specified by:
iterator
in classAbstractObjectSet<K>
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
size
public int size()
- Specified by:
size
in interfaceCollection<K>
- Specified by:
size
in interfaceSet<K>
- Specified by:
size
in classAbstractCollection<K>
-
addAll
public boolean addAll(Collection<? extends K> c)
- Specified by:
addAll
in interfaceCollection<K>
- Specified by:
addAll
in interfaceSet<K>
- Overrides:
addAll
in classAbstractCollection<K>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<K>
- Specified by:
removeAll
in interfaceSet<K>
- Overrides:
removeAll
in classAbstractCollection<K>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<K>
- Specified by:
retainAll
in interfaceSet<K>
- Overrides:
retainAll
in classAbstractCollection<K>
-
clone
public Object clone()
-
-