Package it.unimi.dsi.fastutil.doubles
Class DoubleSets.Singleton
java.lang.Object
java.util.AbstractCollection<Double>
it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
it.unimi.dsi.fastutil.doubles.AbstractDoubleSet
it.unimi.dsi.fastutil.doubles.DoubleSets.Singleton
- All Implemented Interfaces:
DoubleCollection,DoubleIterable,DoubleSet,Serializable,Cloneable,Iterable<Double>,Collection<Double>,Set<Double>
- Direct Known Subclasses:
DoubleSortedSets.Singleton
- Enclosing class:
- DoubleSets
public static class DoubleSets.Singleton extends AbstractDoubleSet 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
Modifier and Type Method Description booleanaddAll(DoubleCollection c)Adds all elements of the given type-specific collection to this collection.booleanaddAll(Collection<? extends Double> c)Objectclone()booleancontains(double k)Returnstrueif this collection contains the specified element.DoubleListIteratoriterator()Returns a type-specific iterator on the elements of this collection.booleanremove(double k)Removes an element from this set.booleanremoveAll(DoubleCollection c)Remove from this collection all elements in the given type-specific collection.booleanremoveAll(Collection<?> c)booleanretainAll(DoubleCollection c)Retains in this collection only elements from the given type-specific collection.booleanretainAll(Collection<?> c)intsize()Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
add, add, contains, containsAll, remove, toArray, toDoubleArray, toDoubleArray, toStringMethods inherited from class java.util.AbstractCollection
clear, containsAll, isEmpty, toArray, toArrayMethods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleCollection
add, containsAll, removeIf, removeIf, toArray, toDoubleArray, toDoubleArrayMethods inherited from interface java.util.Set
clear, containsAll, isEmpty, spliterator, toArray, toArray
-
Method Details
-
contains
public boolean contains(double k)Description copied from class:AbstractDoubleCollectionReturnstrueif this collection contains the specified element.This implementation iterates over the elements in the collection, looking for the specified element.
- Specified by:
containsin interfaceDoubleCollection- Overrides:
containsin classAbstractDoubleCollection- See Also:
Collection.contains(Object)
-
remove
public boolean remove(double k)Description copied from class:AbstractDoubleSetRemoves an element from this set.Note that the corresponding method of a type-specific collection is
rem(). This unfortunate situation is caused by the clash with the similarly named index-based method in theListinterface. Delegates to the type-specificrem()method implemented by type-specific abstractCollectionsuperclass.- Specified by:
removein interfaceDoubleSet- Overrides:
removein classAbstractDoubleSet- See Also:
Collection.remove(Object)
-
iterator
Description copied from interface:DoubleCollectionReturns 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:
iteratorin interfaceCollection<Double>- Specified by:
iteratorin interfaceDoubleCollection- Specified by:
iteratorin interfaceDoubleIterable- Specified by:
iteratorin interfaceDoubleSet- Specified by:
iteratorin interfaceIterable<Double>- Specified by:
iteratorin interfaceSet<Double>- Specified by:
iteratorin classAbstractDoubleSet- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
size
public int size()- Specified by:
sizein interfaceCollection<Double>- Specified by:
sizein interfaceSet<Double>- Specified by:
sizein classAbstractCollection<Double>
-
addAll
- Specified by:
addAllin interfaceCollection<Double>- Specified by:
addAllin interfaceSet<Double>- Overrides:
addAllin classAbstractCollection<Double>
-
removeAll
- Specified by:
removeAllin interfaceCollection<Double>- Specified by:
removeAllin interfaceSet<Double>- Overrides:
removeAllin classAbstractCollection<Double>
-
retainAll
- Specified by:
retainAllin interfaceCollection<Double>- Specified by:
retainAllin interfaceSet<Double>- Overrides:
retainAllin classAbstractCollection<Double>
-
addAll
Description copied from interface:DoubleCollectionAdds all elements of the given type-specific collection to this collection.- Specified by:
addAllin interfaceDoubleCollection- Overrides:
addAllin classAbstractDoubleCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.addAll(Collection)
-
removeAll
Description copied from interface:DoubleCollectionRemove from this collection all elements in the given type-specific collection.- Specified by:
removeAllin interfaceDoubleCollection- Overrides:
removeAllin classAbstractDoubleCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.removeAll(Collection)
-
retainAll
Description copied from interface:DoubleCollectionRetains in this collection only elements from the given type-specific collection.- Specified by:
retainAllin interfaceDoubleCollection- Overrides:
retainAllin classAbstractDoubleCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
clone
-