Package it.unimi.dsi.fastutil.shorts
Class ShortSets.Singleton
java.lang.Object
java.util.AbstractCollection<Short>
it.unimi.dsi.fastutil.shorts.AbstractShortCollection
it.unimi.dsi.fastutil.shorts.AbstractShortSet
it.unimi.dsi.fastutil.shorts.ShortSets.Singleton
- All Implemented Interfaces:
ShortCollection
,ShortIterable
,ShortSet
,Serializable
,Cloneable
,Iterable<Short>
,Collection<Short>
,Set<Short>
- Direct Known Subclasses:
ShortSortedSets.Singleton
- Enclosing class:
ShortSets
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 Short> c) clone()
boolean
contains
(short k) Returnstrue
if this collection contains the specified element.void
forEach
(ShortConsumer action) Performs the given action for each element of this type-specificIterable
until all elements have been processed or the action throws an exception.void
Deprecated.Returns a widened primitive iterator on the elements of this collection.Returns widened primitive spliterator on the elements of this collection.iterator()
Returns a type-specific iterator on the elements of this collection.boolean
remove
(short 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
(ShortPredicate 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.short[]
Returns a primitive type array containing the items of this collection.Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortSet
equals, hashCode, rem
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
add, add, contains, containsAll, containsAll, remove, toArray, toShortArray, toString
Methods inherited from class java.util.AbstractCollection
clear, isEmpty, toArray
Methods inherited from interface java.util.Collection
toArray
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, toArray
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortCollection
add, containsAll, intParallelStream, intStream, parallelStream, removeIf, stream, toArray, toShortArray
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortIterable
forEach
-
Method Details
-
contains
public boolean contains(short k) Description copied from class:AbstractShortCollection
Returnstrue
if this collection contains the specified element.- Specified by:
contains
in interfaceShortCollection
- Overrides:
contains
in classAbstractShortCollection
- See Also:
-
remove
public boolean remove(short k) Description copied from class:AbstractShortSet
Removes an element from this set. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.- Specified by:
remove
in interfaceShortSet
- Overrides:
remove
in classAbstractShortSet
- See Also:
-
iterator
Description copied from interface:ShortCollection
Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfaceCollection<Short>
- Specified by:
iterator
in interfaceIterable<Short>
- Specified by:
iterator
in interfaceSet<Short>
- Specified by:
iterator
in interfaceShortCollection
- Specified by:
iterator
in interfaceShortIterable
- Specified by:
iterator
in interfaceShortSet
- Specified by:
iterator
in classAbstractShortSet
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
-
spliterator
Description copied from interface:ShortSet
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<Short>
- Specified by:
spliterator
in interfaceIterable<Short>
- Specified by:
spliterator
in interfaceSet<Short>
- Specified by:
spliterator
in interfaceShortCollection
- Specified by:
spliterator
in interfaceShortIterable
- Specified by:
spliterator
in interfaceShortSet
- Returns:
- a type-specific spliterator on the elements of this collection.
-
size
public int size()- Specified by:
size
in interfaceCollection<Short>
- Specified by:
size
in interfaceSet<Short>
- Specified by:
size
in classAbstractCollection<Short>
-
toShortArray
public short[] toShortArray()Description copied from interface:ShortCollection
Returns a primitive type array containing the items of this collection.- Specified by:
toShortArray
in interfaceShortCollection
- Overrides:
toShortArray
in classAbstractShortCollection
- Returns:
- a primitive type array containing the items of this collection.
- See Also:
-
forEach
Deprecated.Description copied from interface:ShortIterable
- Specified by:
forEach
in interfaceIterable<Short>
- Specified by:
forEach
in interfaceShortIterable
-
addAll
Description copied from class:AbstractShortCollection
- Specified by:
addAll
in interfaceCollection<Short>
- Specified by:
addAll
in interfaceSet<Short>
- Overrides:
addAll
in classAbstractShortCollection
-
removeAll
Description copied from class:AbstractShortCollection
- Specified by:
removeAll
in interfaceCollection<Short>
- Specified by:
removeAll
in interfaceSet<Short>
- Overrides:
removeAll
in classAbstractShortCollection
-
retainAll
Description copied from class:AbstractShortCollection
- Specified by:
retainAll
in interfaceCollection<Short>
- Specified by:
retainAll
in interfaceSet<Short>
- Overrides:
retainAll
in classAbstractShortCollection
-
removeIf
Deprecated.Description copied from interface:ShortCollection
- Specified by:
removeIf
in interfaceCollection<Short>
- Specified by:
removeIf
in interfaceShortCollection
-
forEach
Description copied from interface:ShortIterable
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 interfaceShortIterable
- Parameters:
action
- the action to be performed for each element.- See Also:
-
addAll
Description copied from interface:ShortCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceShortCollection
- Overrides:
addAll
in classAbstractShortCollection
- 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:ShortCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceShortCollection
- Overrides:
removeAll
in classAbstractShortCollection
- 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:ShortCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceShortCollection
- Overrides:
retainAll
in classAbstractShortCollection
- 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:ShortCollection
Remove from this collection all elements which satisfy the given predicate.- Specified by:
removeIf
in interfaceShortCollection
- Parameters:
filter
- a predicate which returnstrue
for elements to be removed.- Returns:
true
if any elements were removed.- See Also:
-
intIterator
Description copied from interface:ShortCollection
Returns 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:
intIterator
in interfaceShortCollection
- Specified by:
intIterator
in interfaceShortIterable
- Returns:
- a widened primitive iterator on the elements of this collection.
-
intSpliterator
Description copied from interface:ShortCollection
Returns 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:
intSpliterator
in interfaceShortCollection
- Specified by:
intSpliterator
in interfaceShortIterable
- Returns:
- a widened primitive spliterator on the elements of this collection.
-
toArray
Deprecated.- Specified by:
toArray
in interfaceCollection<Short>
- Specified by:
toArray
in interfaceSet<Short>
- Overrides:
toArray
in classAbstractCollection<Short>
-
clone
-