Package it.unimi.dsi.fastutil.ints
Class IntSets.Singleton
java.lang.Object
java.util.AbstractCollection<Integer>
it.unimi.dsi.fastutil.ints.AbstractIntCollection
it.unimi.dsi.fastutil.ints.AbstractIntSet
it.unimi.dsi.fastutil.ints.IntSets.Singleton
- All Implemented Interfaces:
IntCollection
,IntIterable
,IntSet
,Serializable
,Cloneable
,Iterable<Integer>
,Collection<Integer>
,Set<Integer>
- Direct Known Subclasses:
IntSortedSets.Singleton
- Enclosing class:
IntSets
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 Integer> c) clone()
boolean
contains
(int k) Returnstrue
if this collection contains the specified element.void
Deprecated.void
forEach
(IntConsumer 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
(int 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
(IntPredicate 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.int[]
Returns a primitive type array containing the items of this collection.Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntSet
equals, hashCode, rem
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntCollection
add, add, contains, containsAll, containsAll, forEach, remove, removeIf, toArray, toIntArray, 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.ints.IntCollection
add, containsAll, intIterator, intParallelStream, intSpliterator, intStream, parallelStream, removeIf, stream, toArray, toIntArray
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterable
forEach
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, toArray
-
Method Details
-
contains
public boolean contains(int k) Description copied from class:AbstractIntCollection
Returnstrue
if this collection contains the specified element.- Specified by:
contains
in interfaceIntCollection
- Overrides:
contains
in classAbstractIntCollection
- See Also:
-
remove
public boolean remove(int k) Description copied from class:AbstractIntSet
Removes an element from this set. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.- Specified by:
remove
in interfaceIntSet
- Overrides:
remove
in classAbstractIntSet
- See Also:
-
iterator
Description copied from interface:IntCollection
Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfaceCollection<Integer>
- Specified by:
iterator
in interfaceIntCollection
- Specified by:
iterator
in interfaceIntIterable
- Specified by:
iterator
in interfaceIntSet
- Specified by:
iterator
in interfaceIterable<Integer>
- Specified by:
iterator
in interfaceSet<Integer>
- Specified by:
iterator
in classAbstractIntSet
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
-
spliterator
Description copied from interface:IntSet
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<Integer>
- Specified by:
spliterator
in interfaceIntCollection
- Specified by:
spliterator
in interfaceIntIterable
- Specified by:
spliterator
in interfaceIntSet
- Specified by:
spliterator
in interfaceIterable<Integer>
- Specified by:
spliterator
in interfaceSet<Integer>
- Returns:
- a type-specific spliterator on the elements of this collection.
-
size
public int size()- Specified by:
size
in interfaceCollection<Integer>
- Specified by:
size
in interfaceSet<Integer>
- Specified by:
size
in classAbstractCollection<Integer>
-
toIntArray
public int[] toIntArray()Description copied from interface:IntCollection
Returns a primitive type array containing the items of this collection.- Specified by:
toIntArray
in interfaceIntCollection
- Overrides:
toIntArray
in classAbstractIntCollection
- Returns:
- a primitive type array containing the items of this collection.
- See Also:
-
forEach
Deprecated.Description copied from interface:IntIterable
- Specified by:
forEach
in interfaceIntIterable
- Specified by:
forEach
in interfaceIterable<Integer>
-
addAll
Description copied from class:AbstractIntCollection
- Specified by:
addAll
in interfaceCollection<Integer>
- Specified by:
addAll
in interfaceSet<Integer>
- Overrides:
addAll
in classAbstractIntCollection
-
removeAll
Description copied from class:AbstractIntCollection
- Specified by:
removeAll
in interfaceCollection<Integer>
- Specified by:
removeAll
in interfaceSet<Integer>
- Overrides:
removeAll
in classAbstractIntCollection
-
retainAll
Description copied from class:AbstractIntCollection
- Specified by:
retainAll
in interfaceCollection<Integer>
- Specified by:
retainAll
in interfaceSet<Integer>
- Overrides:
retainAll
in classAbstractIntCollection
-
removeIf
Deprecated.Description copied from interface:IntCollection
- Specified by:
removeIf
in interfaceCollection<Integer>
- Specified by:
removeIf
in interfaceIntCollection
-
forEach
Description copied from interface:IntIterable
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 interfaceIntIterable
- Parameters:
action
- the action to be performed for each element.- See Also:
-
addAll
Description copied from interface:IntCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceIntCollection
- Overrides:
addAll
in classAbstractIntCollection
- 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:IntCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceIntCollection
- Overrides:
removeAll
in classAbstractIntCollection
- 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:IntCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceIntCollection
- Overrides:
retainAll
in classAbstractIntCollection
- 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:IntCollection
Remove from this collection all elements which satisfy the given predicate.- Specified by:
removeIf
in interfaceIntCollection
- 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<Integer>
- Specified by:
toArray
in interfaceSet<Integer>
- Overrides:
toArray
in classAbstractCollection<Integer>
-
clone
-