public interface IntSet extends Set<Integer>
Modifier and Type | Method and Description |
---|---|
boolean |
add(int i)
Adds the given int to this set and returns
true if it was set or false if it was already present |
boolean |
addAll(IntSet set)
Adds all ints from the provided set into this one
|
boolean |
contains(int i)
Whether this set contains the given int
|
boolean |
containsAll(IntSet set)
Whether this set contains all ints in the given IntSet
|
default void |
forEach(IntConsumer action)
Performs the given action for each int of the
IntSet
until all elements have been processed or the action throws an
exception. |
default Spliterator.OfInt |
intSpliterator()
Creates a
Spliterator.OfInt over the ints in this set. |
IntStream |
intStream()
A stream of ints representing the data in this set
|
PrimitiveIterator.OfInt |
iterator()
A primtive iterator that allows iteration over the int values.
|
boolean |
remove(int i)
Removes, if present, the int from the set and returns if it was present or not
|
boolean |
removeAll(IntSet set)
Removes all ints from this IntSet that are in the provided IntSet
|
default boolean |
removeIf(IntPredicate filter)
Removes all of the ints of this set that satisfy the given
predicate.
|
boolean |
retainAll(IntSet c)
Modifies this set to remove all ints that are not present in the provided IntSet
|
void |
set(int i)
Adds or sets the int without returning whether it was previously set
|
default Stream<Integer> |
stream() |
default int[] |
toIntArray()
Returns an array containing all of the elements in this set.
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, spliterator, toArray, toArray
parallelStream, removeIf
boolean add(int i)
true
if it was set or false
if it was already presenti
- the int value to addvoid set(int i)
i
- the value to make sure is in the setboolean remove(int i)
i
- the int to removeboolean contains(int i)
i
- the int to checkboolean addAll(IntSet set)
set
- the set of ints to addboolean containsAll(IntSet set)
set
- the set to check if all are presentboolean removeAll(IntSet set)
set
- the ints to remove from this IntSetboolean retainAll(IntSet c)
c
- the ints this set should kepPrimitiveIterator.OfInt iterator()
IntStream intStream()
default Stream<Integer> stream()
stream
in interface Collection<Integer>
default void forEach(IntConsumer action)
IntSet
until all elements have been processed or the action throws an
exception. Unless otherwise specified by the implementing class,
actions are performed in the order of iteration (if an iteration order
is specified). Exceptions thrown by the action are relayed to the
caller.action
- The action to be performed for each elementNullPointerException
- if the specified action is nulldefault Spliterator.OfInt intSpliterator()
Spliterator.OfInt
over the ints in this set.
The Spliterator.OfInt
reports Spliterator.DISTINCT
.
Implementations should document the reporting of additional
characteristic values.
Spliterator.OfInt
over the ints in this setdefault boolean removeIf(IntPredicate filter)
filter
- a predicate which returns true
for ints to be
removedtrue
if any ints were removedNullPointerException
- if the specified filter is nullUnsupportedOperationException
- if elements cannot be removed
from this collection. Implementations may throw this exception if a
matching element cannot be removed or if, in general, removal is not
supported.default int[] toIntArray()
Copyright © 2021 JBoss by Red Hat. All rights reserved.