Package it.unimi.dsi.fastutil.bytes
Interface ByteSet
- All Superinterfaces:
ByteCollection
,ByteIterable
,Collection<Byte>
,Iterable<Byte>
,Set<Byte>
- All Known Subinterfaces:
ByteSortedSet
- All Known Implementing Classes:
AbstractByteSet
,AbstractByteSortedSet
,ByteArraySet
,ByteAVLTreeSet
,ByteLinkedOpenCustomHashSet
,ByteLinkedOpenHashSet
,ByteOpenCustomHashSet
,ByteOpenHashSet
,ByteRBTreeSet
,ByteSets.EmptySet
,ByteSets.Singleton
,ByteSets.SynchronizedSet
,ByteSets.UnmodifiableSet
,ByteSortedSets.EmptySet
,ByteSortedSets.Singleton
,ByteSortedSets.SynchronizedSortedSet
,ByteSortedSets.UnmodifiableSortedSet
A type-specific
Set
; provides some additional methods that use polymorphism to avoid
(un)boxing.
Additionally, this interface strengthens (again) iterator()
.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Deprecated.Please use the corresponding type-specific method instead.default boolean
Deprecated.Please use the corresponding type-specific method instead.iterator()
Returns a type-specific iterator on the elements of this set.static ByteSet
of()
Returns an immutable empty set.static ByteSet
of
(byte e) Returns an immutable set with the element given.static ByteSet
of
(byte... a) Returns an immutable list with the elements given.static ByteSet
of
(byte e0, byte e1) Returns an immutable set with the elements given.static ByteSet
of
(byte e0, byte e1, byte e2) Returns an immutable set with the elements given.default boolean
rem
(byte k) Deprecated.Please useremove()
instead.boolean
remove
(byte k) Removes an element from this set.default boolean
Deprecated.Please use the corresponding type-specific method instead.default ByteSpliterator
Returns a type-specific spliterator on the elements of this set.Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteCollection
add, addAll, contains, containsAll, intIterator, intParallelStream, intSpliterator, intStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toByteArray, toByteArray
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteIterable
forEach, forEach, forEach
Methods inherited from interface java.util.Collection
toArray
-
Method Details
-
iterator
ByteIterator iterator()Returns a type-specific iterator on the elements of this set.- Specified by:
iterator
in interfaceByteCollection
- Specified by:
iterator
in interfaceByteIterable
- Specified by:
iterator
in interfaceCollection<Byte>
- Specified by:
iterator
in interfaceIterable<Byte>
- Specified by:
iterator
in interfaceSet<Byte>
- Returns:
- a type-specific iterator on the elements of this set.
- See Also:
- API Notes:
- This specification strengthens the one given in
Iterable.iterator()
, which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extendsSet
.Also, this is generally the only
iterator
method subclasses should override.
-
spliterator
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 interfaceByteCollection
- Specified by:
spliterator
in interfaceByteIterable
- Specified by:
spliterator
in interfaceCollection<Byte>
- Specified by:
spliterator
in interfaceIterable<Byte>
- Specified by:
spliterator
in interfaceSet<Byte>
- Returns:
- a type-specific spliterator on the elements of this collection.
- Since:
- 8.5.0
- API Notes:
- This specification strengthens the one given in
Collection.spliterator()
, which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extendsSet
.Also, this is generally the only
spliterator
method subclasses should override. - Implementation Specification:
- The default implementation returns a late-binding spliterator (see
Spliterator
for documentation on what binding policies mean) that wraps this instance's type specificiterator()
.Additionally, it reports
Spliterator.SIZED
andSpliterator.DISTINCT
. - Implementation Notes:
- As this default implementation wraps the iterator, and
Iterator
is an inherently linear API, the returned spliterator will yield limited performance gains when run in parallel contexts, as the returned spliterator'strySplit()
will have linear runtime.
-
remove
boolean remove(byte k) Removes an element from this set.- See Also:
- API Notes:
- Note that the corresponding method of a type-specific collection is
rem()
. This unfortunate situation is caused by the clash with the similarly named index-based method in theList
interface.
-
remove
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
remove
in interfaceByteCollection
- Specified by:
remove
in interfaceCollection<Byte>
- Specified by:
remove
in interfaceSet<Byte>
-
add
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
add
in interfaceByteCollection
- Specified by:
add
in interfaceCollection<Byte>
- Specified by:
add
in interfaceSet<Byte>
-
contains
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
contains
in interfaceByteCollection
- Specified by:
contains
in interfaceCollection<Byte>
- Specified by:
contains
in interfaceSet<Byte>
-
rem
Deprecated.Please useremove()
instead.Removes an element from this set.This method is inherited from the type-specific collection this type-specific set is based on, but it should not used as this interface reinstates
remove()
as removal method.- Specified by:
rem
in interfaceByteCollection
- See Also:
-
of
Returns an immutable empty set.- Returns:
- an immutable empty set.
-
of
Returns an immutable set with the element given.- Parameters:
e
- an element.- Returns:
- an immutable set containing
e
.
-
of
Returns an immutable set with the elements given.- Parameters:
e0
- the first element.e1
- the second element.- Returns:
- an immutable set containing
e0
ande1
. - Throws:
IllegalArgumentException
- if there were duplicate entries.
-
of
Returns an immutable set with the elements given.- Parameters:
e0
- the first element.e1
- the second element.e2
- the third element.- Returns:
- an immutable set containing
e0
,e1
, ande2
. - Throws:
IllegalArgumentException
- if there were duplicate entries.
-
of
Returns an immutable list with the elements given.- Parameters:
a
- the list of elements that will be in the final set.- Returns:
- an immutable set containing the elements in
a
. - Throws:
IllegalArgumentException
- if there are any duplicate entries.
-