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:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds all elements of the given type-specific collection to this collection.boolean
addAll
(Collection<? extends Double> c) clone()
boolean
contains
(double k) Returnstrue
if this collection contains the specified element.void
Deprecated.void
forEach
(DoubleConsumer action) Performs the given action for each element of this type-specificIterable
until all elements have been processed or the action throws an exception.iterator()
Returns a type-specific iterator on the elements of this collection.boolean
remove
(double k) Removes an element from this set.boolean
Remove from this collection all elements in the given type-specific collection.boolean
removeAll
(Collection<?> c) boolean
removeIf
(DoublePredicate filter) Remove from this collection all elements which satisfy the given predicate.boolean
Deprecated.boolean
Retains in this collection only elements from the given type-specific collection.boolean
retainAll
(Collection<?> c) int
size()
Returns a type-specific spliterator on the elements of this set.Object[]
toArray()
Deprecated.double[]
Returns a primitive type array containing the items of this collection.Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleSet
equals, hashCode, rem
Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
add, add, contains, containsAll, containsAll, forEach, remove, removeIf, toArray, toDoubleArray, toString
Methods inherited from class java.util.AbstractCollection
clear, isEmpty, toArray
Methods inherited from interface java.util.Collection
toArray
Methods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleCollection
add, containsAll, doubleIterator, doubleParallelStream, doubleSpliterator, doubleStream, parallelStream, removeIf, stream, toArray, toDoubleArray
Methods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleIterable
forEach
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, toArray
-
Method Details
-
contains
public boolean contains(double k) Description copied from class:AbstractDoubleCollection
Returnstrue
if this collection contains the specified element.- Specified by:
contains
in interfaceDoubleCollection
- Overrides:
contains
in classAbstractDoubleCollection
- See Also:
-
remove
public boolean remove(double k) Description copied from class:AbstractDoubleSet
Removes an element from this set. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.- Specified by:
remove
in interfaceDoubleSet
- Overrides:
remove
in classAbstractDoubleSet
- See Also:
-
iterator
Description copied from interface:DoubleCollection
Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfaceCollection<Double>
- Specified by:
iterator
in interfaceDoubleCollection
- Specified by:
iterator
in interfaceDoubleIterable
- Specified by:
iterator
in interfaceDoubleSet
- Specified by:
iterator
in interfaceIterable<Double>
- Specified by:
iterator
in interfaceSet<Double>
- Specified by:
iterator
in classAbstractDoubleSet
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
-
spliterator
Description copied from interface:DoubleSet
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 interfaceCollection<Double>
- Specified by:
spliterator
in interfaceDoubleCollection
- Specified by:
spliterator
in interfaceDoubleIterable
- Specified by:
spliterator
in interfaceDoubleSet
- Specified by:
spliterator
in interfaceIterable<Double>
- Specified by:
spliterator
in interfaceSet<Double>
- Returns:
- a type-specific spliterator on the elements of this collection.
-
size
public int size()- Specified by:
size
in interfaceCollection<Double>
- Specified by:
size
in interfaceSet<Double>
- Specified by:
size
in classAbstractCollection<Double>
-
toDoubleArray
public double[] toDoubleArray()Description copied from interface:DoubleCollection
Returns a primitive type array containing the items of this collection.- Specified by:
toDoubleArray
in interfaceDoubleCollection
- Overrides:
toDoubleArray
in classAbstractDoubleCollection
- Returns:
- a primitive type array containing the items of this collection.
- See Also:
-
forEach
Deprecated.Description copied from interface:DoubleIterable
- Specified by:
forEach
in interfaceDoubleIterable
- Specified by:
forEach
in interfaceIterable<Double>
-
addAll
Description copied from class:AbstractDoubleCollection
- Specified by:
addAll
in interfaceCollection<Double>
- Specified by:
addAll
in interfaceSet<Double>
- Overrides:
addAll
in classAbstractDoubleCollection
-
removeAll
Description copied from class:AbstractDoubleCollection
- Specified by:
removeAll
in interfaceCollection<Double>
- Specified by:
removeAll
in interfaceSet<Double>
- Overrides:
removeAll
in classAbstractDoubleCollection
-
retainAll
Description copied from class:AbstractDoubleCollection
- Specified by:
retainAll
in interfaceCollection<Double>
- Specified by:
retainAll
in interfaceSet<Double>
- Overrides:
retainAll
in classAbstractDoubleCollection
-
removeIf
Deprecated.Description copied from interface:DoubleCollection
- Specified by:
removeIf
in interfaceCollection<Double>
- Specified by:
removeIf
in interfaceDoubleCollection
-
forEach
Description copied from interface:DoubleIterable
Performs the given action for each element of this type-specificIterable
until all elements have been processed or the action throws an exception.- Specified by:
forEach
in interfaceDoubleIterable
- Parameters:
action
- the action to be performed for each element.- See Also:
-
addAll
Description copied from interface:DoubleCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceDoubleCollection
- Overrides:
addAll
in classAbstractDoubleCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
-
removeAll
Description copied from interface:DoubleCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceDoubleCollection
- Overrides:
removeAll
in classAbstractDoubleCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
-
retainAll
Description copied from interface:DoubleCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceDoubleCollection
- Overrides:
retainAll
in classAbstractDoubleCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
-
removeIf
Description copied from interface:DoubleCollection
Remove from this collection all elements which satisfy the given predicate.- Specified by:
removeIf
in interfaceDoubleCollection
- Parameters:
filter
- a predicate which returnstrue
for elements to be removed.- Returns:
true
if any elements were removed.- See Also:
-
toArray
Deprecated.- Specified by:
toArray
in interfaceCollection<Double>
- Specified by:
toArray
in interfaceSet<Double>
- Overrides:
toArray
in classAbstractCollection<Double>
-
clone
-