Package it.unimi.dsi.fastutil.floats
Class FloatSets.Singleton
java.lang.Object
java.util.AbstractCollection<java.lang.Float>
it.unimi.dsi.fastutil.floats.AbstractFloatCollection
it.unimi.dsi.fastutil.floats.AbstractFloatSet
it.unimi.dsi.fastutil.floats.FloatSets.Singleton
- All Implemented Interfaces:
FloatCollection,it.unimi.dsi.fastutil.floats.FloatIterable,FloatSet,java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<java.lang.Float>,java.util.Collection<java.lang.Float>,java.util.Set<java.lang.Float>
- Direct Known Subclasses:
FloatSortedSets.Singleton
- Enclosing class:
- FloatSets
public static class FloatSets.Singleton extends AbstractFloatSet 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(FloatCollection c)Adds all elements of the given type-specific collection to this collection.booleanaddAll(java.util.Collection<? extends java.lang.Float> c)java.lang.Objectclone()booleancontains(float k)Returnstrueif this collection contains the specified element.it.unimi.dsi.fastutil.doubles.DoubleIteratordoubleIterator()Returns a widened primitive iterator on the elements of this collection.it.unimi.dsi.fastutil.doubles.DoubleSpliteratordoubleSpliterator()Returns widened primitive spliterator on the elements of this collection.voidforEach(FloatConsumer action)voidforEach(java.util.function.Consumer<? super java.lang.Float> action)Deprecated.FloatListIteratoriterator()Returns a type-specific iterator on the elements of this collection.booleanremove(float k)Removes an element from this set.booleanremoveAll(FloatCollection c)Remove from this collection all elements in the given type-specific collection.booleanremoveAll(java.util.Collection<?> c)booleanremoveIf(FloatPredicate filter)Remove from this collection all elements which satisfy the given predicate.booleanremoveIf(java.util.function.Predicate<? super java.lang.Float> filter)Deprecated.booleanretainAll(FloatCollection c)Retains in this collection only elements from the given type-specific collection.booleanretainAll(java.util.Collection<?> c)intsize()it.unimi.dsi.fastutil.floats.FloatSpliteratorspliterator()Returns a type-specific spliterator on the elements of this set.java.lang.Object[]toArray()Deprecated.float[]toFloatArray()Returns a primitive type array containing the items of this collection.Methods inherited from class it.unimi.dsi.fastutil.floats.AbstractFloatSet
equals, hashCode, remMethods inherited from class it.unimi.dsi.fastutil.floats.AbstractFloatCollection
add, add, contains, containsAll, containsAll, remove, toArray, toFloatArray, 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.floats.FloatCollection
add, containsAll, doubleParallelStream, doubleStream, parallelStream, removeIf, stream, toArray, toFloatArrayMethods inherited from interface it.unimi.dsi.fastutil.floats.FloatIterable
forEachMethods inherited from interface java.util.Set
clear, containsAll, isEmpty, toArray
-
Method Details
-
contains
public boolean contains(float k)Description copied from class:AbstractFloatCollectionReturnstrueif this collection contains the specified element.- Specified by:
containsin interfaceFloatCollection- Overrides:
containsin classAbstractFloatCollection- See Also:
Collection.contains(Object)
-
remove
public boolean remove(float k)Description copied from class:AbstractFloatSetRemoves an element from this set. Delegates to the type-specificrem()method implemented by type-specific abstractCollectionsuperclass.- Specified by:
removein interfaceFloatSet- Overrides:
removein classAbstractFloatSet- See Also:
Collection.remove(Object)
-
iterator
Description copied from interface:FloatCollectionReturns a type-specific iterator on the elements of this collection.- Specified by:
iteratorin interfacejava.util.Collection<java.lang.Float>- Specified by:
iteratorin interfaceFloatCollection- Specified by:
iteratorin interfaceit.unimi.dsi.fastutil.floats.FloatIterable- Specified by:
iteratorin interfaceFloatSet- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Float>- Specified by:
iteratorin interfacejava.util.Set<java.lang.Float>- Specified by:
iteratorin classAbstractFloatSet- Returns:
- a type-specific iterator on the elements of this collection.
-
spliterator
public it.unimi.dsi.fastutil.floats.FloatSpliterator spliterator()Description copied from interface:FloatSetReturns 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.Float>- Specified by:
spliteratorin interfaceFloatCollection- Specified by:
spliteratorin interfaceit.unimi.dsi.fastutil.floats.FloatIterable- Specified by:
spliteratorin interfaceFloatSet- Specified by:
spliteratorin interfacejava.lang.Iterable<java.lang.Float>- Specified by:
spliteratorin interfacejava.util.Set<java.lang.Float>- Returns:
- a type-specific spliterator on the elements of this collection.
-
size
public int size()- Specified by:
sizein interfacejava.util.Collection<java.lang.Float>- Specified by:
sizein interfacejava.util.Set<java.lang.Float>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Float>
-
toFloatArray
public float[] toFloatArray()Description copied from interface:FloatCollectionReturns a primitive type array containing the items of this collection.- Specified by:
toFloatArrayin interfaceFloatCollection- Overrides:
toFloatArrayin classAbstractFloatCollection- 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.Float> action)Deprecated.- Specified by:
forEachin interfaceit.unimi.dsi.fastutil.floats.FloatIterable- Specified by:
forEachin interfacejava.lang.Iterable<java.lang.Float>
-
addAll
public boolean addAll(java.util.Collection<? extends java.lang.Float> c)Description copied from class:AbstractFloatCollection- Specified by:
addAllin interfacejava.util.Collection<java.lang.Float>- Specified by:
addAllin interfacejava.util.Set<java.lang.Float>- Overrides:
addAllin classAbstractFloatCollection
-
removeAll
public boolean removeAll(java.util.Collection<?> c)Description copied from class:AbstractFloatCollection- Specified by:
removeAllin interfacejava.util.Collection<java.lang.Float>- Specified by:
removeAllin interfacejava.util.Set<java.lang.Float>- Overrides:
removeAllin classAbstractFloatCollection
-
retainAll
public boolean retainAll(java.util.Collection<?> c)Description copied from class:AbstractFloatCollection- Specified by:
retainAllin interfacejava.util.Collection<java.lang.Float>- Specified by:
retainAllin interfacejava.util.Set<java.lang.Float>- Overrides:
retainAllin classAbstractFloatCollection
-
removeIf
@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Float> filter)Deprecated.Description copied from interface:FloatCollection- Specified by:
removeIfin interfacejava.util.Collection<java.lang.Float>- Specified by:
removeIfin interfaceFloatCollection
-
forEach
- Specified by:
forEachin interfaceit.unimi.dsi.fastutil.floats.FloatIterable
-
addAll
Description copied from interface:FloatCollectionAdds all elements of the given type-specific collection to this collection.- Specified by:
addAllin interfaceFloatCollection- Overrides:
addAllin classAbstractFloatCollection- 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:FloatCollectionRemove from this collection all elements in the given type-specific collection.- Specified by:
removeAllin interfaceFloatCollection- Overrides:
removeAllin classAbstractFloatCollection- 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:FloatCollectionRetains in this collection only elements from the given type-specific collection.- Specified by:
retainAllin interfaceFloatCollection- Overrides:
retainAllin classAbstractFloatCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
removeIf
Description copied from interface:FloatCollectionRemove from this collection all elements which satisfy the given predicate.- Specified by:
removeIfin interfaceFloatCollection- Parameters:
filter- a predicate which returnstruefor elements to be removed.- Returns:
trueif any elements were removed.- See Also:
Collection.removeIf(java.util.function.Predicate)
-
doubleIterator
public it.unimi.dsi.fastutil.doubles.DoubleIterator doubleIterator()Description copied from interface:FloatCollectionReturns a widened primitive iterator on the elements of this collection.This method is provided for the purpose of APIs that expect only the JDK's primitive iterators, of which there are only
int,long, anddouble.- Specified by:
doubleIteratorin interfaceFloatCollection- Specified by:
doubleIteratorin interfaceit.unimi.dsi.fastutil.floats.FloatIterable- Returns:
- a widened primitive iterator on the elements of this collection.
-
doubleSpliterator
public it.unimi.dsi.fastutil.doubles.DoubleSpliterator doubleSpliterator()Description copied from interface:FloatCollectionReturns widened primitive spliterator on the elements of this collection.This method is provided for the purpose of APIs that expect only the JDK's primitive spliterators, of which there are only
int,long, anddouble.- Specified by:
doubleSpliteratorin interfaceFloatCollection- Specified by:
doubleSpliteratorin interfaceit.unimi.dsi.fastutil.floats.FloatIterable- Returns:
- a widened primitive spliterator on the elements of this collection.
-
toArray
@Deprecated public java.lang.Object[] toArray()Deprecated.- Specified by:
toArrayin interfacejava.util.Collection<java.lang.Float>- Specified by:
toArrayin interfacejava.util.Set<java.lang.Float>- Overrides:
toArrayin classjava.util.AbstractCollection<java.lang.Float>
-
clone
public java.lang.Object clone()
-