Package it.unimi.dsi.fastutil.doubles
Class DoubleSets.Singleton
java.lang.Object
java.util.AbstractCollection<java.lang.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,java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<java.lang.Double>,java.util.Collection<java.lang.Double>,java.util.Set<java.lang.Double>
- Direct Known Subclasses:
DoubleSortedSets.Singleton
- Enclosing class:
- DoubleSets
public static class DoubleSets.Singleton extends AbstractDoubleSet 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(DoubleCollection c)Adds all elements of the given type-specific collection to this collection.booleanaddAll(java.util.Collection<? extends java.lang.Double> c)java.lang.Objectclone()booleancontains(double k)Returnstrueif this collection contains the specified element.voidforEach(java.util.function.Consumer<? super java.lang.Double> action)Deprecated.voidforEach(java.util.function.DoubleConsumer action)Performs the given action for each element of this type-specificIterableuntil all elements have been processed or the action throws an exception.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(java.util.Collection<?> c)booleanremoveIf(java.util.function.DoublePredicate filter)Remove from this collection all elements which satisfy the given predicate.booleanremoveIf(java.util.function.Predicate<? super java.lang.Double> filter)Deprecated.booleanretainAll(DoubleCollection c)Retains in this collection only elements from the given type-specific collection.booleanretainAll(java.util.Collection<?> c)intsize()DoubleSpliteratorspliterator()Returns a type-specific spliterator on the elements of this set.java.lang.Object[]toArray()Deprecated.double[]toDoubleArray()Returns a primitive type array containing the items of this collection.Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleSet
equals, hashCode, remMethods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
add, add, contains, containsAll, containsAll, forEach, remove, removeIf, toArray, toDoubleArray, toStringMethods inherited from class java.util.AbstractCollection
clear, isEmpty, toArrayMethods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
toArrayMethods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleCollection
add, containsAll, doubleIterator, doubleParallelStream, doubleSpliterator, doubleStream, parallelStream, removeIf, stream, toArray, toDoubleArrayMethods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleIterable
forEachMethods inherited from interface java.util.Set
clear, containsAll, isEmpty, toArray
-
Method Details
-
contains
public boolean contains(double k)Description copied from class:AbstractDoubleCollectionReturnstrueif this collection contains 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. 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.- Specified by:
iteratorin interfacejava.util.Collection<java.lang.Double>- Specified by:
iteratorin interfaceDoubleCollection- Specified by:
iteratorin interfaceDoubleIterable- Specified by:
iteratorin interfaceDoubleSet- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Double>- Specified by:
iteratorin interfacejava.util.Set<java.lang.Double>- Specified by:
iteratorin classAbstractDoubleSet- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
spliterator
Description copied from interface:DoubleSetReturns 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<java.lang.Double>- Specified by:
spliteratorin interfaceDoubleCollection- Specified by:
spliteratorin interfaceDoubleIterable- Specified by:
spliteratorin interfaceDoubleSet- Specified by:
spliteratorin interfacejava.lang.Iterable<java.lang.Double>- Specified by:
spliteratorin interfacejava.util.Set<java.lang.Double>- Returns:
- a type-specific spliterator on the elements of this collection.
-
size
public int size()- Specified by:
sizein interfacejava.util.Collection<java.lang.Double>- Specified by:
sizein interfacejava.util.Set<java.lang.Double>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Double>
-
toDoubleArray
public double[] toDoubleArray()Description copied from interface:DoubleCollectionReturns a primitive type array containing the items of this collection.- Specified by:
toDoubleArrayin interfaceDoubleCollection- Overrides:
toDoubleArrayin classAbstractDoubleCollection- Returns:
- a primitive type array containing the items of this collection.
- See Also:
Collection.toArray()
-
forEach
@Deprecated public void forEach(java.util.function.Consumer<? super java.lang.Double> action)Deprecated.Description copied from interface:DoubleIterable- Specified by:
forEachin interfaceDoubleIterable- Specified by:
forEachin interfacejava.lang.Iterable<java.lang.Double>
-
addAll
public boolean addAll(java.util.Collection<? extends java.lang.Double> c)Description copied from class:AbstractDoubleCollection- Specified by:
addAllin interfacejava.util.Collection<java.lang.Double>- Specified by:
addAllin interfacejava.util.Set<java.lang.Double>- Overrides:
addAllin classAbstractDoubleCollection
-
removeAll
public boolean removeAll(java.util.Collection<?> c)Description copied from class:AbstractDoubleCollection- Specified by:
removeAllin interfacejava.util.Collection<java.lang.Double>- Specified by:
removeAllin interfacejava.util.Set<java.lang.Double>- Overrides:
removeAllin classAbstractDoubleCollection
-
retainAll
public boolean retainAll(java.util.Collection<?> c)Description copied from class:AbstractDoubleCollection- Specified by:
retainAllin interfacejava.util.Collection<java.lang.Double>- Specified by:
retainAllin interfacejava.util.Set<java.lang.Double>- Overrides:
retainAllin classAbstractDoubleCollection
-
removeIf
@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Double> filter)Deprecated.Description copied from interface:DoubleCollection- Specified by:
removeIfin interfacejava.util.Collection<java.lang.Double>- Specified by:
removeIfin interfaceDoubleCollection
-
forEach
public void forEach(java.util.function.DoubleConsumer action)Description copied from interface:DoubleIterablePerforms the given action for each element of this type-specificIterableuntil all elements have been processed or the action throws an exception.- Specified by:
forEachin interfaceDoubleIterable- Parameters:
action- the action to be performed for each element.- See Also:
Iterable.forEach(java.util.function.Consumer)
-
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)
-
removeIf
public boolean removeIf(java.util.function.DoublePredicate filter)Description copied from interface:DoubleCollectionRemove from this collection all elements which satisfy the given predicate.- Specified by:
removeIfin interfaceDoubleCollection- Parameters:
filter- a predicate which returnstruefor elements to be removed.- Returns:
trueif any elements were removed.- See Also:
Collection.removeIf(java.util.function.Predicate)
-
toArray
@Deprecated public java.lang.Object[] toArray()Deprecated.- Specified by:
toArrayin interfacejava.util.Collection<java.lang.Double>- Specified by:
toArrayin interfacejava.util.Set<java.lang.Double>- Overrides:
toArrayin classjava.util.AbstractCollection<java.lang.Double>
-
clone
public java.lang.Object clone()
-