public interface ByteSet extends ByteCollection, java.util.Set<java.lang.Byte>
Set
; provides some additional methods that use polymorphism to avoid (un)boxing.
Additionally, this interface strengthens (again) iterator()
.
Set
Modifier and Type | Method and Description |
---|---|
default boolean |
add(java.lang.Byte o)
Deprecated.
Please use the corresponding type-specific method instead.
|
default boolean |
contains(java.lang.Object o)
Deprecated.
Please use the corresponding type-specific method instead.
|
ByteIterator |
iterator()
Returns a type-specific iterator on the elements of this set.
|
static ByteSet |
of()
Returns an immutable empty set.
|
static ByteSet |
of(byte... a)
Returns an immutable list with the elements given.
|
static ByteSet |
of(byte e)
Returns an immutable set with the element 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 use
remove() instead. |
boolean |
remove(byte k)
Removes an element from this set.
|
default boolean |
remove(java.lang.Object o)
Deprecated.
Please use the corresponding type-specific method instead.
|
default ByteSpliterator |
spliterator()
Returns a type-specific spliterator on the elements of this set.
|
add, addAll, contains, containsAll, intIterator, intParallelStream, intSpliterator, intStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toByteArray, toByteArray
forEach, forEach, forEach
ByteIterator iterator()
iterator
in interface ByteCollection
iterator
in interface ByteIterable
iterator
in interface java.util.Collection<java.lang.Byte>
iterator
in interface java.lang.Iterable<java.lang.Byte>
iterator
in interface java.util.Set<java.lang.Byte>
Iterable.iterator()
Iterable.iterator()
,
which was already strengthened in the corresponding type-specific class,
but was weakened by the fact that this interface extends Set
.
Also, this is generally the only iterator
method subclasses should override.
default ByteSpliterator spliterator()
Set spliterators must report at least Spliterator.DISTINCT
.
See Set.spliterator()
for more documentation on the requirements
of the returned spliterator.
spliterator
in interface ByteCollection
spliterator
in interface ByteIterable
spliterator
in interface java.util.Collection<java.lang.Byte>
spliterator
in interface java.lang.Iterable<java.lang.Byte>
spliterator
in interface java.util.Set<java.lang.Byte>
Collection.spliterator()
, which was already
strengthened in the corresponding type-specific class,
but was weakened by the fact that this interface extends Set
.
Also, this is generally the only spliterator
method subclasses should override.
Spliterator
for documentation on what binding policies mean)
that wraps this instance's type specific iterator()
.
Additionally, it reports Spliterator.SIZED
and Spliterator.DISTINCT
.
Iterator
is an inherently linear API, the returned spliterator will yield limited performance gains
when run in parallel contexts, as the returned spliterator's
trySplit()
will have linear runtime.boolean remove(byte k)
Collection.remove(Object)
rem()
.
This unfortunate situation is caused by the clash
with the similarly named index-based method in the List
interface.@Deprecated default boolean remove(java.lang.Object o)
remove
in interface ByteCollection
remove
in interface java.util.Collection<java.lang.Byte>
remove
in interface java.util.Set<java.lang.Byte>
@Deprecated default boolean add(java.lang.Byte o)
add
in interface ByteCollection
add
in interface java.util.Collection<java.lang.Byte>
add
in interface java.util.Set<java.lang.Byte>
@Deprecated default boolean contains(java.lang.Object o)
contains
in interface ByteCollection
contains
in interface java.util.Collection<java.lang.Byte>
contains
in interface java.util.Set<java.lang.Byte>
@Deprecated default boolean rem(byte k)
remove()
instead.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.
rem
in interface ByteCollection
Collection.remove(Object)
static ByteSet of()
static ByteSet of(byte e)
e
- an element.e
.static ByteSet of(byte e0, byte e1)
e0
- the first element.e1
- the second element.e0
and e1
.java.lang.IllegalArgumentException
- if there were duplicate entries.static ByteSet of(byte e0, byte e1, byte e2)
e0
- the first element.e1
- the second element.e2
- the third element.e0
, e1
, and e2
.java.lang.IllegalArgumentException
- if there were duplicate entries.static ByteSet of(byte... a)
a
- the list of elements that will be in the final set.a
.java.lang.IllegalArgumentException
- if there are any duplicate entries.