Package it.unimi.dsi.fastutil.longs
Class LongSets.Singleton
java.lang.Object
java.util.AbstractCollection<Long>
it.unimi.dsi.fastutil.longs.AbstractLongCollection
it.unimi.dsi.fastutil.longs.AbstractLongSet
it.unimi.dsi.fastutil.longs.LongSets.Singleton
- All Implemented Interfaces:
LongCollection
,LongIterable
,LongSet
,Serializable
,Cloneable
,Iterable<Long>
,Collection<Long>
,Set<Long>
- Direct Known Subclasses:
LongSortedSets.Singleton
- Enclosing class:
LongSets
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 Long> c) clone()
boolean
contains
(long k) Returnstrue
if this collection contains the specified element.void
Deprecated.void
forEach
(LongConsumer 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
(long 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
(LongPredicate 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.long[]
Returns a primitive type array containing the items of this collection.Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongSet
equals, hashCode, rem
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, add, contains, containsAll, containsAll, forEach, remove, removeIf, toArray, toLongArray, 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.longs.LongCollection
add, containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, removeIf, stream, toArray, toLongArray
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable
forEach
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, toArray
-
Method Details
-
contains
public boolean contains(long k) Description copied from class:AbstractLongCollection
Returnstrue
if this collection contains the specified element.- Specified by:
contains
in interfaceLongCollection
- Overrides:
contains
in classAbstractLongCollection
- See Also:
-
remove
public boolean remove(long k) Description copied from class:AbstractLongSet
Removes an element from this set. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.- Specified by:
remove
in interfaceLongSet
- Overrides:
remove
in classAbstractLongSet
- See Also:
-
iterator
Description copied from interface:LongCollection
Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfaceCollection<Long>
- Specified by:
iterator
in interfaceIterable<Long>
- Specified by:
iterator
in interfaceLongCollection
- Specified by:
iterator
in interfaceLongIterable
- Specified by:
iterator
in interfaceLongSet
- Specified by:
iterator
in interfaceSet<Long>
- Specified by:
iterator
in classAbstractLongSet
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
-
spliterator
Description copied from interface:LongSet
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<Long>
- Specified by:
spliterator
in interfaceIterable<Long>
- Specified by:
spliterator
in interfaceLongCollection
- Specified by:
spliterator
in interfaceLongIterable
- Specified by:
spliterator
in interfaceLongSet
- Specified by:
spliterator
in interfaceSet<Long>
- Returns:
- a type-specific spliterator on the elements of this collection.
-
size
public int size()- Specified by:
size
in interfaceCollection<Long>
- Specified by:
size
in interfaceSet<Long>
- Specified by:
size
in classAbstractCollection<Long>
-
toLongArray
public long[] toLongArray()Description copied from interface:LongCollection
Returns a primitive type array containing the items of this collection.- Specified by:
toLongArray
in interfaceLongCollection
- Overrides:
toLongArray
in classAbstractLongCollection
- Returns:
- a primitive type array containing the items of this collection.
- See Also:
-
forEach
Deprecated.Description copied from interface:LongIterable
- Specified by:
forEach
in interfaceIterable<Long>
- Specified by:
forEach
in interfaceLongIterable
-
addAll
Description copied from class:AbstractLongCollection
- Specified by:
addAll
in interfaceCollection<Long>
- Specified by:
addAll
in interfaceSet<Long>
- Overrides:
addAll
in classAbstractLongCollection
-
removeAll
Description copied from class:AbstractLongCollection
- Specified by:
removeAll
in interfaceCollection<Long>
- Specified by:
removeAll
in interfaceSet<Long>
- Overrides:
removeAll
in classAbstractLongCollection
-
retainAll
Description copied from class:AbstractLongCollection
- Specified by:
retainAll
in interfaceCollection<Long>
- Specified by:
retainAll
in interfaceSet<Long>
- Overrides:
retainAll
in classAbstractLongCollection
-
removeIf
Deprecated.Description copied from interface:LongCollection
- Specified by:
removeIf
in interfaceCollection<Long>
- Specified by:
removeIf
in interfaceLongCollection
-
forEach
Description copied from interface:LongIterable
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 interfaceLongIterable
- Parameters:
action
- the action to be performed for each element.- See Also:
-
addAll
Description copied from interface:LongCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceLongCollection
- Overrides:
addAll
in classAbstractLongCollection
- 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:LongCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceLongCollection
- Overrides:
removeAll
in classAbstractLongCollection
- 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:LongCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceLongCollection
- Overrides:
retainAll
in classAbstractLongCollection
- 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:LongCollection
Remove from this collection all elements which satisfy the given predicate.- Specified by:
removeIf
in interfaceLongCollection
- 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<Long>
- Specified by:
toArray
in interfaceSet<Long>
- Overrides:
toArray
in classAbstractCollection<Long>
-
clone
-