@FunctionalInterface public interface IntSequence extends IntList
Iterable sequence of int values with Stream-like operations for refining,
transforming and collating the list of ints.| Modifier and Type | Method and Description |
|---|---|
default boolean |
all(java.util.function.IntPredicate predicate) |
default boolean |
any(java.util.function.IntPredicate predicate) |
default IntSequence |
append(int... ints)
Append the given
ints to the end of this IntSequence. |
default IntSequence |
append(IntIterable that)
|
default IntSequence |
append(java.util.stream.IntStream stream)
Append the
int values of the given IntStream to the end of this IntSequence. |
default IntSequence |
append(java.lang.Iterable<java.lang.Integer> iterable)
Append the
Integers in the given Iterable to the end of this IntSequence. |
default IntSequence |
append(java.util.Iterator<java.lang.Integer> iterator)
Append the
Integers in the given Iterator to the end of this IntSequence. |
default IntSequence |
append(java.util.PrimitiveIterator.OfInt iterator)
|
default IntSequence |
append(java.util.stream.Stream<java.lang.Integer> stream)
Append the
Integers in the given Stream to the end of this IntSequence. |
default java.util.OptionalInt |
at(int index) |
default java.util.OptionalInt |
at(int index,
java.util.function.IntPredicate predicate) |
default Sequence<IntSequence> |
batch(int size)
Batch the elements of this
IntSequence into a sequence of IntSequences of distinct elements,
each with the given batch size. |
default Sequence<IntSequence> |
batch(IntBiPredicate predicate)
Batch the elements of this
IntSequence into a sequence of IntSequences of distinct elements,
where the given predicate determines where to split the lists of partitioned elements. |
default Sequence<java.lang.Integer> |
box()
Map the
ints in this IntSequence to their boxed Integer counterparts. |
static IntSequence |
cache(IntIterable iterable)
Create an
IntSequence from a cached copy of an IntIterable. |
static IntSequence |
cache(java.util.stream.IntStream stream)
Create an
IntSequence from a cached copy of an IntStream. |
static IntSequence |
cache(java.lang.Iterable<java.lang.Integer> iterable)
Create an
IntSequence from a cached copy of an Iterable of Integer values. |
static IntSequence |
cache(java.util.Iterator<java.lang.Integer> iterator)
Create an
IntSequence from a cached copy of an Iterator of Integers. |
static IntSequence |
cache(java.util.PrimitiveIterator.OfInt iterator)
Create an
IntSequence from a cached copy of a PrimitiveIterator.OfInt. |
static IntSequence |
cache(java.util.stream.Stream<java.lang.Integer> stream)
Create an
IntSequence from a cached copy of a Stream of Integers. |
default <C> C |
collect(java.util.function.Supplier<? extends C> constructor,
java.util.function.ObjIntConsumer<? super C> adder)
Collect this
IntSequence into an arbitrary container using the given constructor and adder. |
default <C> C |
collectInto(C result,
java.util.function.ObjIntConsumer<? super C> adder)
Collect this
IntSequence into the given container using the given adder. |
default <U extends IntCollection> |
collectInto(U collection)
Collect this
IntSequence into the given IntCollection. |
static IntSequence |
decreasingFrom(int start)
A decreasing
Sequence of int values starting at the given value. |
default IntSequence |
distinct() |
static IntSequence |
empty()
Create empty
IntSequence with no contents. |
default IntSequence |
endingAt(int terminal)
Terminate this
IntSequence sequence at the given element, including it as the last element in this
IntSequence sequence. |
default IntSequence |
endingAt(java.util.function.IntPredicate terminal)
Terminate this
IntSequence sequence at the element that satisfies the given predicate, including the
element as the last element in this IntSequence sequence. |
default IntSequence |
excluding(int... elements) |
default IntSequence |
filter(java.util.function.IntPredicate predicate)
Filter the elements in this
IntSequence, keeping only the elements that match the given
IntPredicate. |
default IntSequence |
filterBack(int firstPrevious,
IntBiPredicate predicate)
Filter this
IntSequence to another sequence of ints while peeking at the previous value in the
sequence. |
default IntSequence |
filterForward(int lastNext,
IntBiPredicate predicate)
Filter this
IntSequence to another sequence of ints while peeking at the next int in the sequence. |
default IntSequence |
filterIndexed(IntBiPredicate predicate)
Filter the elements in this
IntSequence, keeping only the elements that match the given
IntBiPredicate, which is passed each double together with its index in the sequence. |
default java.util.OptionalInt |
first() |
default java.util.OptionalInt |
first(java.util.function.IntPredicate predicate) |
default void |
forEachIntIndexed(IntBiConsumer action)
Perform the given action for each
int in this IntSequence, with the index of each element passed
as the second parameter in the action. |
static IntSequence |
from(int[] is,
int size)
Create an
IntSequence with the given ints, limited to the given size. |
static IntSequence |
from(int[] is,
int offset,
int size)
Create an
IntSequence with the given ints, reading from the given offset and limited to the
given size. |
static IntSequence |
from(IntIterable iterable)
Create an
IntSequence from an IntIterable. |
static IntSequence |
from(java.lang.Iterable<java.lang.Integer> iterable)
Create an
IntSequence from an Iterable of Integer values. |
static IntSequence |
generate(java.util.function.IntSupplier supplier) |
default IntSequence |
including(int... elements) |
static IntSequence |
increasingFrom(int start)
An increasing
IntSequence of int values starting at the given value. |
default IntSequence |
interleave(IntIterable that)
Interleave the elements in this
IntSequence with those of the given IntIterable, stopping when
either sequence finishes. |
default boolean |
isEmpty() |
default java.lang.String |
join(java.lang.String delimiter)
Join this
IntSequence into a string separated by the given delimiter. |
default java.lang.String |
join(java.lang.String prefix,
java.lang.String delimiter,
java.lang.String suffix)
Join this
IntSequence into a string separated by the given delimiter, with the given prefix and suffix. |
default java.util.OptionalInt |
last() |
default java.util.OptionalInt |
last(java.util.function.IntPredicate predicate) |
default IntSequence |
limit(int limit)
Limit the maximum number of
ints returned by this IntSequence. |
default IntSequence |
map(java.util.function.IntUnaryOperator mapper)
Map the values in this
IntSequence sequence to another set of values specified by the given mapper function. |
default IntSequence |
mapBack(int firstPrevious,
java.util.function.IntBinaryOperator mapper)
Map this
IntSequence to another sequence of ints while peeking at the previous value in the
sequence. |
default IntSequence |
mapForward(int lastNext,
java.util.function.IntBinaryOperator mapper)
Map this
IntSequence to another sequence of ints while peeking at the next int in the sequence. |
default IntSequence |
mapIndexed(java.util.function.IntBinaryOperator mapper)
Map the values in this
IntSequence sequence to another set of values specified by the given mapper function, while providing the current index to the mapper. |
default java.util.OptionalInt |
max() |
default java.util.OptionalInt |
min() |
static IntSequence |
multiGenerate(java.util.function.Supplier<? extends java.util.function.IntSupplier> supplierSupplier) |
static IntSequence |
negative()
An
IntSequence of all the negative int values starting at -1 and ending at
Integer.MIN_VALUE. |
static IntSequence |
negativeFromZero()
An
IntSequence of all the negative int values starting at 0 and ending at
Integer.MIN_VALUE. |
default boolean |
none(java.util.function.IntPredicate predicate) |
static IntSequence |
of(int... is)
Create an
IntSequence with the given ints. |
static IntSequence |
once(java.util.stream.IntStream stream)
Create a once-only
IntSequence from an IntStream of items. |
static IntSequence |
once(java.util.Iterator<java.lang.Integer> iterator)
Create a once-only
IntSequence from an Iterator of Integer values. |
static IntSequence |
once(java.util.PrimitiveIterator.OfInt iterator)
Create a once-only
IntSequence from a PrimitiveIterator.OfInt. |
static IntSequence |
once(java.util.stream.Stream<java.lang.Integer> stream)
Create a only-only
Sequence from a Stream of items. |
default IntSequence |
peek(java.util.function.IntConsumer action)
Allow the given
IntConsumer to see each element in this IntSequence as it is traversed. |
default IntSequence |
peekIndexed(IntBiConsumer action)
Allow the given
IntBiConsumer to see each element together with its index in this IntSequence
as it is traversed. |
static IntSequence |
positive()
An
IntSequence of all the positive int values starting at 1 and ending at
Integer.MAX_VALUE. |
static IntSequence |
positiveFromZero()
An
IntSequence of all the positive int values starting at 0 and ending at
Integer.MAX_VALUE. |
default IntSequence |
prefix(int... cs)
Prefix the ints in this
IntSequence with the given ints. |
static IntSequence |
random() |
static IntSequence |
random(int upper) |
static IntSequence |
random(int lower,
int upper) |
static IntSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier) |
static IntSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
int upper) |
static IntSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
int lower,
int upper) |
static IntSequence |
range(int start,
int end)
A
Sequence of all the int values between the given start and end positions, inclusive. |
static IntSequence |
range(int start,
int end,
int step)
A
Sequence of the int values between the given start and end positions, stepping with the
given step. |
static IntSequence |
read(java.io.InputStream inputStream)
Create an
IntSequence from an InputStream which iterates over the bytes provided in the
input stream as ints. |
static IntSequence |
recurse(int seed,
java.util.function.IntUnaryOperator op)
Returns an
IntSequence sequence produced by recursively applying the given operation to the given
seed, which forms the first element of the sequence, the second being f(seed), the third f(f(seed)) and so on. |
default java.util.OptionalInt |
reduce(java.util.function.IntBinaryOperator operator)
Reduce this
IntSequence into a single int by iteratively applying the given binary operator to
the current result and each int in the sequence. |
default int |
reduce(int identity,
java.util.function.IntBinaryOperator operator)
Reduce this
IntSequence into a single int by iteratively applying the given binary operator to
the current result and each int in the sequence, starting with the given identity as the initial result. |
default IntSequence |
repeat()
Repeat this sequence of ints forever, looping back to the beginning when the iterator runs out of ints.
|
default IntSequence |
repeat(int times)
Repeat this sequence of ints x times, looping back to the beginning when the iterator runs out of ints.
|
default IntSequence |
reverse() |
default int |
size() |
default IntSequence |
skip(int skip)
Skip a set number of
ints in this IntSequence. |
default IntSequence |
skipTail(int skip)
Skip a set number of
ints at the end of this IntSequence. |
default IntSequence |
sorted() |
default Sequence<IntSequence> |
split(int element)
Split the
ints of this IntSequence into a sequence of IntSequences of distinct elements,
around the given int. |
default Sequence<IntSequence> |
split(java.util.function.IntPredicate predicate)
Split the
ints of this IntSequence into a sequence of IntSequences of distinct
elements, where the given predicate determines which ints to split the partitioned elements around. |
default java.util.Spliterator.OfInt |
spliterator() |
default IntSequence |
startingAfter(int element)
Begin this
IntSequence just after the given element is encountered, not including the element in the
IntSequence. |
default IntSequence |
startingAfter(java.util.function.IntPredicate predicate)
Begin this
IntSequence just after the given predicate is satisfied, not including the element that
satisfies the predicate in the IntSequence. |
default IntSequence |
startingFrom(int element)
Begin this
IntSequence when the given element is encountered, including the element as the first element
in the IntSequence. |
default IntSequence |
startingFrom(java.util.function.IntPredicate predicate)
Begin this
IntSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the IntSequence. |
default IntSequence |
step(int step)
Skip x number of steps in between each invocation of the iterator of this
IntSequence. |
static IntSequence |
steppingFrom(int start,
int step)
A
Sequence of all the int values starting at the given value and stepping with the given
step. |
default IntSequence |
suffix(int... cs)
Suffix the ints in this
IntSequence with the given ints. |
default CharSeq |
toChars()
Convert this sequence of ints to a sequence of chars corresponding to the downcast char value of each int.
|
default CharSeq |
toChars(IntToCharFunction mapper)
Convert this sequence of ints to a sequence of chars using the given converter function.
|
default <U extends IntCollection> |
toCollection(java.util.function.Supplier<? extends U> constructor)
Collect this
IntSequence into an IntCollection of the type determined by the given constructor. |
default DoubleSequence |
toDoubles()
Convert this sequence of ints to a sequence of doubles corresponding to the cast double value of each int.
|
default DoubleSequence |
toDoubles(java.util.function.IntToDoubleFunction mapper)
Convert this sequence of ints to a sequence of doubles using the given converter function.
|
default IntList |
toList()
Collect the elements in this
IntSequence into an IntList. |
default IntList |
toList(java.util.function.Supplier<? extends IntList> constructor)
Collect the elements in this
IntSequence into an IntList of the type determined by the given
constructor. |
default LongSequence |
toLongs()
Convert this sequence of ints to a sequence of longs.
|
default LongSequence |
toLongs(java.util.function.IntToLongFunction mapper)
Convert this sequence of ints to a sequence of longs using the given converter function.
|
default <T> Sequence<T> |
toSequence(java.util.function.IntFunction<T> mapper)
|
default IntSet |
toSet()
Collect the elements in this
IntSequence into an IntSet. |
default <S extends IntSet> |
toSet(java.util.function.Supplier<? extends S> constructor)
Collect the elements in this
IntSequence into an IntSet of the type determined by the given
constructor. |
default IntSortedSet |
toSortedSet()
Collect the elements in this
IntSequence into an IntSortedSet. |
default IntSequence |
until(int terminal)
Terminate this
IntSequence sequence before the given element, with the previous element as the last
element in this IntSequence sequence. |
default IntSequence |
until(java.util.function.IntPredicate terminal)
Terminate this
IntSequence sequence before the element that satisfies the given predicate, with the
previous
element as the last element in this IntSequence sequence. |
default Sequence<IntSequence> |
window(int window)
Window the elements of this
IntSequence into a sequence of IntSequences of elements, each with
the size of the given window. |
default Sequence<IntSequence> |
window(int window,
int step)
Window the elements of this
IntSequence into a sequence of IntSequences of elements, each with
the size of the given window, stepping step elements between each window. |
add, add, addAll, addAll, addAllInts, addAllInts, addAllIntsAt, addAllIntsAt, addInt, addIntAt, binarySearch, clear, contains, containsAll, copy, get, getInt, indexOf, indexOfInt, lastIndexOf, lastIndexOfInt, listIterator, listIterator, remove, remove, removeAll, removeIf, removeIntAt, replaceAll, replaceAllInts, retainAll, set, setInt, sort, sortInts, sortInts, subList, toArray, toArraytoIntArrayasInputStream, containsAllInts, containsAllInts, containsAnyInts, containsAnyInts, containsInt, forEach, forEachInt, from, intStream, once, parallelIntStream, removeAllInts, removeAllInts, removeInt, removeIntsIf, retainAllInts, retainAllInts, sequencestatic IntSequence empty()
IntSequence with no contents.static IntSequence of(int... is)
IntSequence with the given ints.of in interface IntIterableof in interface IntListIntList of the given elements.static IntSequence from(int[] is, int size)
IntSequence with the given ints, limited to the given size.static IntSequence from(int[] is, int offset, int size)
IntSequence with the given ints, reading from the given offset and limited to the
given size.static IntSequence from(IntIterable iterable)
IntSequence from an IntIterable.cache(IntIterable)static IntSequence from(java.lang.Iterable<java.lang.Integer> iterable)
IntSequence from an Iterable of Integer values.from in interface IntIterablecache(Iterable)static IntSequence once(java.util.PrimitiveIterator.OfInt iterator)
IntSequence from a PrimitiveIterator.OfInt. Note that IntSequences
created from PrimitiveIterator.OfInt cannot be passed over more than once. Further attempts will
register the IntSequence as empty.once in interface IntIterablecache(PrimitiveIterator.OfInt)static IntSequence once(java.util.Iterator<java.lang.Integer> iterator)
IntSequence from an Iterator of Integer values. Note that
IntSequence created from Iterators cannot be passed over more than once. Further attempts will
register the IntSequence as empty.cache(Iterator)static IntSequence once(java.util.stream.IntStream stream)
IntSequence from an IntStream of items. Note that IntSequences
created from IntStreams cannot be passed over more than once. Further attempts will register the
IntSequence as empty.java.lang.IllegalStateException - if the IntStream is exhausted.cache(IntStream)static IntSequence once(java.util.stream.Stream<java.lang.Integer> stream)
Sequence from a Stream of items. Note that Sequences created
fromStreams cannot be passed over more than once. Further attempts will register the IntSequence
as empty.java.lang.IllegalStateException - if the Stream is exhausted.cache(Stream)static IntSequence read(java.io.InputStream inputStream)
IntSequence from an InputStream which iterates over the bytes provided in the
input stream as ints. The InputStream must support InputStream.reset() or the IntSequence
will only be available to iterate over once. The InputStream will be reset in between iterations,
if possible. If an IOException occurs during iteration, an IterationException will be thrown.
The InputStream will not be closed by the IntSequence when iteration finishes, it must be closed
externally when iteration is finished.read in interface IntIterablestatic IntSequence cache(IntIterable iterable)
IntSequence from a cached copy of an IntIterable.cache(Iterable),
cache(IntStream),
cache(Stream),
cache(PrimitiveIterator.OfInt),
cache(Iterator),
from(IntIterable)static IntSequence cache(java.util.PrimitiveIterator.OfInt iterator)
IntSequence from a cached copy of a PrimitiveIterator.OfInt.cache(Iterator),
cache(IntStream),
cache(Stream),
cache(IntIterable),
cache(Iterable),
once(PrimitiveIterator.OfInt)static IntSequence cache(java.util.Iterator<java.lang.Integer> iterator)
IntSequence from a cached copy of an Iterator of Integers.cache(PrimitiveIterator.OfInt),
cache(IntStream),
cache(Stream),
cache(IntIterable),
cache(Iterable),
once(Iterator)static IntSequence cache(java.util.stream.IntStream stream)
IntSequence from a cached copy of an IntStream.cache(Stream),
cache(IntIterable),
cache(Iterable),
cache(PrimitiveIterator.OfInt),
cache(Iterator),
once(IntStream)static IntSequence cache(java.util.stream.Stream<java.lang.Integer> stream)
IntSequence from a cached copy of a Stream of Integers.cache(IntStream),
cache(IntIterable),
cache(Iterable),
cache(PrimitiveIterator.OfInt),
cache(Iterator),
once(Stream)static IntSequence cache(java.lang.Iterable<java.lang.Integer> iterable)
IntSequence from a cached copy of an Iterable of Integer values.cache(IntIterable),
cache(IntStream),
cache(Stream),
cache(PrimitiveIterator.OfInt),
cache(Iterator),
from(Iterable)static IntSequence positive()
IntSequence of all the positive int values starting at 1 and ending at
Integer.MAX_VALUE.static IntSequence positiveFromZero()
IntSequence of all the positive int values starting at 0 and ending at
Integer.MAX_VALUE.static IntSequence increasingFrom(int start)
IntSequence of int values starting at the given value. This sequence never
terminates but will wrap to Integer.MIN_VALUE when passing Integer.MAX_VALUE.static IntSequence negative()
IntSequence of all the negative int values starting at -1 and ending at
Integer.MIN_VALUE.static IntSequence negativeFromZero()
IntSequence of all the negative int values starting at 0 and ending at
Integer.MIN_VALUE.static IntSequence decreasingFrom(int start)
Sequence of int values starting at the given value. This sequence never
terminates but will wrap to Integer.MAX_VALUE when passing Integer.MIN_VALUE.static IntSequence steppingFrom(int start, int step)
Sequence of all the int values starting at the given value and stepping with the given
step. Pass in a negative step to create a decreasing sequence. This sequence never terminates but will wrap when
passing Integer.MAX_VALUE or Integer.MIN_VALUE.static IntSequence range(int start, int end)
Sequence of all the int values between the given start and end positions, inclusive.static IntSequence range(int start, int end, int step)
Sequence of the int values between the given start and end positions, stepping with the
given step. The step must be given as a positive value, even if the range is a decreasing range.java.lang.IllegalArgumentException - if step < 0range(int, int),
steppingFrom(int, int),
increasingFrom(int),
decreasingFrom(int),
positive(),
positiveFromZero(),
negative(),
negativeFromZero()static IntSequence recurse(int seed, java.util.function.IntUnaryOperator op)
IntSequence sequence produced by recursively applying the given operation to the given
seed, which forms the first element of the sequence, the second being f(seed), the third f(f(seed)) and so on.
The returned IntSequence sequence never terminates naturally.IntSequence sequence produced by recursively applying the given operation to the given seedgenerate(IntSupplier),
endingAt(int),
until(int)static IntSequence generate(java.util.function.IntSupplier supplier)
IntSequence that is generated from the given supplier and thus never terminates.recurse(int, IntUnaryOperator),
endingAt(int),
until(int)static IntSequence multiGenerate(java.util.function.Supplier<? extends java.util.function.IntSupplier> supplierSupplier)
IntSequence where each List.iterator() is generated by polling for a supplier and then
using it to generate the sequence of ints. The sequence never terminates.recurse(int, IntUnaryOperator),
endingAt(int),
until(int)static IntSequence random()
IntSequence of random ints that never terminates. Each run of this IntSequence's
List.iterator() will produce a new random sequence of ints. This method is equivalent to
random(Random::new).random(Supplier),
Random.nextInt()static IntSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier)
IntSequence of random ints that never terminates. The given supplier is used to produce the
instance of Random that is used, one for each new List.iterator().random(),
Random.nextInt()static IntSequence random(int upper)
IntSequence of random ints between 0, inclusive, and the upper bound, exclusive,
that never terminates. Each run of this IntSequence's List.iterator() will produce a new random
sequence of ints. This method is equivalent to random(Random::new, upper.random(Supplier, int),
Random.nextInt(int)static IntSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, int upper)
IntSequence of random ints between 0, inclusive, and the upper bound, exclusive,
that never terminates. The given supplier is used to produce the instance of Random that is used, one
for each new List.iterator().random(int),
Random.nextInt(int)static IntSequence random(int lower, int upper)
IntSequence of random ints between the lower bound, inclusive, and upper bound, exclusive,
that never terminates. Each run of this IntSequence's List.iterator() will produce a new random
sequence of ints. This method is equivalent to random(Random::new, lower, upper.random(Supplier, int, int),
Random.nextInt(int)static IntSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, int lower, int upper)
IntSequence of random ints between the lower bound, inclusive, and upper bound, exclusive,
that never terminates. The given supplier is used to produce the instance of Random that is used, one
for each new List.iterator().random(int, int),
Random.nextInt(int)default IntSequence until(int terminal)
IntSequence sequence before the given element, with the previous element as the last
element in this IntSequence sequence.default IntSequence endingAt(int terminal)
IntSequence sequence at the given element, including it as the last element in this
IntSequence sequence.default IntSequence until(java.util.function.IntPredicate terminal)
IntSequence sequence before the element that satisfies the given predicate, with the
previous
element as the last element in this IntSequence sequence.default IntSequence endingAt(java.util.function.IntPredicate terminal)
IntSequence sequence at the element that satisfies the given predicate, including the
element as the last element in this IntSequence sequence.default IntSequence startingAfter(int element)
IntSequence just after the given element is encountered, not including the element in the
IntSequence.startingAfter(IntPredicate),
startingFrom(int)default IntSequence startingFrom(int element)
IntSequence when the given element is encountered, including the element as the first element
in the IntSequence.startingFrom(IntPredicate),
startingAfter(int)default IntSequence startingAfter(java.util.function.IntPredicate predicate)
IntSequence just after the given predicate is satisfied, not including the element that
satisfies the predicate in the IntSequence.startingAfter(int),
startingFrom(IntPredicate)default IntSequence startingFrom(java.util.function.IntPredicate predicate)
IntSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the IntSequence.startingFrom(int),
startingAfter(IntPredicate)default IntSequence map(java.util.function.IntUnaryOperator mapper)
IntSequence sequence to another set of values specified by the given mapper function.default IntSequence mapIndexed(java.util.function.IntBinaryOperator mapper)
IntSequence sequence to another set of values specified by the given mapper function, while providing the current index to the mapper.default Sequence<java.lang.Integer> box()
ints in this IntSequence to their boxed Integer counterparts.default <T> Sequence<T> toSequence(java.util.function.IntFunction<T> mapper)
default IntSequence skip(int skip)
ints in this IntSequence.default IntSequence skipTail(int skip)
ints at the end of this IntSequence.default IntSequence limit(int limit)
ints returned by this IntSequence.default IntSequence append(int... ints)
ints to the end of this IntSequence.default IntSequence append(IntIterable that)
default IntSequence append(java.lang.Iterable<java.lang.Integer> iterable)
Integers in the given Iterable to the end of this IntSequence.default IntSequence append(java.util.PrimitiveIterator.OfInt iterator)
ints in the given IntIterator to the end of this IntSequence.
The appended ints will only be available on the first traversal of the resulting IntSequence.
cache(PrimitiveIterator.OfInt)default IntSequence append(java.util.Iterator<java.lang.Integer> iterator)
Integers in the given Iterator to the end of this IntSequence.
The appended Integers will only be available on the first traversal of the resulting
IntSequence.
cache(Iterator)default IntSequence append(java.util.stream.IntStream stream)
int values of the given IntStream to the end of this IntSequence.
The appended ints will only be available on the first traversal of the resulting IntSequence.
cache(IntStream)default IntSequence append(java.util.stream.Stream<java.lang.Integer> stream)
Integers in the given Stream to the end of this IntSequence.
The appended Integers will only be available on the first traversal of the resulting
IntSequence.
cache(Stream)default IntSequence filter(java.util.function.IntPredicate predicate)
IntSequence, keeping only the elements that match the given
IntPredicate.default IntSequence filterIndexed(IntBiPredicate predicate)
IntSequence, keeping only the elements that match the given
IntBiPredicate, which is passed each double together with its index in the sequence.default IntSequence filterBack(int firstPrevious, IntBiPredicate predicate)
IntSequence to another sequence of ints while peeking at the previous value in the
sequence.
The predicate has access to the previous int and the current int in the iteration. If the current int is the first value in the sequence, and there is no previous value, the provided replacement value is used as the first previous value.
default IntSequence filterForward(int lastNext, IntBiPredicate predicate)
IntSequence to another sequence of ints while peeking at the next int in the sequence.
The predicate has access to the current int and the next int in the iteration. If the current int is the last value in the sequence, and there is no next value, the provided replacement value is used as the last next value.
default IntSequence including(int... elements)
IntSequence containing only the ints found in the given target array.default IntSequence excluding(int... elements)
IntSequence containing only the ints not found in the given target array.default IntList toList(java.util.function.Supplier<? extends IntList> constructor)
IntSequence into an IntList of the type determined by the given
constructor.default IntSet toSet()
IntSequence into an IntSet.toSortedSet()default <S extends IntSet> S toSet(java.util.function.Supplier<? extends S> constructor)
IntSequence into an IntSet of the type determined by the given
constructor.default IntSortedSet toSortedSet()
IntSequence into an IntSortedSet.default <U extends IntCollection> U toCollection(java.util.function.Supplier<? extends U> constructor)
IntSequence into an IntCollection of the type determined by the given constructor.default <C> C collect(java.util.function.Supplier<? extends C> constructor,
java.util.function.ObjIntConsumer<? super C> adder)
IntSequence into an arbitrary container using the given constructor and adder.default <U extends IntCollection> U collectInto(U collection)
IntSequence into the given IntCollection.default <C> C collectInto(C result,
java.util.function.ObjIntConsumer<? super C> adder)
IntSequence into the given container using the given adder.default java.lang.String join(java.lang.String delimiter)
IntSequence into a string separated by the given delimiter.default java.lang.String join(java.lang.String prefix,
java.lang.String delimiter,
java.lang.String suffix)
IntSequence into a string separated by the given delimiter, with the given prefix and suffix.default java.util.OptionalInt reduce(java.util.function.IntBinaryOperator operator)
IntSequence into a single int by iteratively applying the given binary operator to
the current result and each int in the sequence.default int reduce(int identity,
java.util.function.IntBinaryOperator operator)
IntSequence into a single int by iteratively applying the given binary operator to
the current result and each int in the sequence, starting with the given identity as the initial result.default java.util.OptionalInt first()
IntSequence or an empty OptionalInt if there are no
ints in the IntSequence.default java.util.OptionalInt last()
IntSequence or an empty OptionalInt if there are no
ints in the IntSequence.default java.util.OptionalInt at(int index)
int at the given index, or an empty OptionalInt if the IntSequence is
smaller than the index.default java.util.OptionalInt first(java.util.function.IntPredicate predicate)
IntSequence matching the given predicate, or an empty
OptionalInt if there are no matching ints in the IntSequence.filter(IntPredicate),
at(int, IntPredicate)default java.util.OptionalInt last(java.util.function.IntPredicate predicate)
IntSequence matching the given predicate, or an empty
OptionalInt if there are no matching ints in the IntSequence.filter(IntPredicate),
at(int, IntPredicate)default java.util.OptionalInt at(int index,
java.util.function.IntPredicate predicate)
int at the given index out of ints matching the given predicate, or an empty
OptionalInt if the matching IntSequence is smaller than the index.filter(IntPredicate)default IntSequence step(int step)
IntSequence.default IntSequence distinct()
IntSequence where each item occurs only once, the first time it is encountered.default java.util.OptionalInt min()
IntSequence.default java.util.OptionalInt max()
IntSequence.default int size()
size in interface java.util.Collection<java.lang.Integer>size in interface java.util.List<java.lang.Integer>IntSequence.default java.util.Spliterator.OfInt spliterator()
spliterator in interface java.util.Collection<java.lang.Integer>spliterator in interface IntCollectionspliterator in interface IntIterablespliterator in interface IntListspliterator in interface java.lang.Iterable<java.lang.Integer>spliterator in interface java.util.List<java.lang.Integer>Spliterator.OfInt for this IntSequence.default boolean all(java.util.function.IntPredicate predicate)
IntSequence satisfy the given predicate, false otherwise.default boolean none(java.util.function.IntPredicate predicate)
IntSequence satisfy the given predicate, false otherwise.default boolean any(java.util.function.IntPredicate predicate)
IntSequence satisfy the given predicate, false otherwise.default IntSequence peek(java.util.function.IntConsumer action)
IntConsumer to see each element in this IntSequence as it is traversed.default IntSequence peekIndexed(IntBiConsumer action)
IntBiConsumer to see each element together with its index in this IntSequence
as it is traversed.default IntSequence sorted()
IntSequence sorted according to the natural order of the int values.reverse()default IntSequence prefix(int... cs)
IntSequence with the given ints.default IntSequence suffix(int... cs)
IntSequence with the given ints.default IntSequence interleave(IntIterable that)
IntSequence with those of the given IntIterable, stopping when
either sequence finishes.default IntSequence reverse()
IntSequence which iterates over this IntSequence in reverse order.sorted()default IntSequence mapBack(int firstPrevious, java.util.function.IntBinaryOperator mapper)
IntSequence to another sequence of ints while peeking at the previous value in the
sequence.
The mapper has access to the previous int and the current int in the iteration. If the current int is the first value in the sequence, and there is no previous value, the provided replacement value is used as the first previous value.
default IntSequence mapForward(int lastNext, java.util.function.IntBinaryOperator mapper)
IntSequence to another sequence of ints while peeking at the next int in the sequence.
The mapper has access to the current int and the next int in the iteration. If the current int is the last value in the sequence, and there is no next value, the provided replacement value is used as the last next value.
default CharSeq toChars()
default LongSequence toLongs()
default DoubleSequence toDoubles()
default CharSeq toChars(IntToCharFunction mapper)
default LongSequence toLongs(java.util.function.IntToLongFunction mapper)
default DoubleSequence toDoubles(java.util.function.IntToDoubleFunction mapper)
default IntSequence repeat()
The resulting sequence will never terminate if this sequence is non-empty.
default IntSequence repeat(int times)
default Sequence<IntSequence> window(int window)
IntSequence into a sequence of IntSequences of elements, each with
the size of the given window. The first item in each list is the second item in the previous list. The final
IntSequence may be shorter than the window. This is equivalent to window(window, 1).default Sequence<IntSequence> window(int window, int step)
IntSequence into a sequence of IntSequences of elements, each with
the size of the given window, stepping step elements between each window. If the given step is less than
the window size, the windows will overlap each other.default Sequence<IntSequence> batch(int size)
IntSequence into a sequence of IntSequences of distinct elements,
each with the given batch size. This is equivalent to window(size, size).default Sequence<IntSequence> batch(IntBiPredicate predicate)
IntSequence into a sequence of IntSequences of distinct elements,
where the given predicate determines where to split the lists of partitioned elements. The predicate is given
the current and next item in the iteration, and if it returns true a partition is created between the elements.default Sequence<IntSequence> split(int element)
ints of this IntSequence into a sequence of IntSequences of distinct elements,
around the given int. The elements around which the sequence is split are not included in the result.default Sequence<IntSequence> split(java.util.function.IntPredicate predicate)
ints of this IntSequence into a sequence of IntSequences of distinct
elements, where the given predicate determines which ints to split the partitioned elements around. The
ints matching the predicate are not included in the result.default boolean isEmpty()
isEmpty in interface java.util.Collection<java.lang.Integer>isEmpty in interface IntCollectionisEmpty in interface IntIterableisEmpty in interface IntListisEmpty in interface java.util.List<java.lang.Integer>IntSequence is empty, false otherwise.default void forEachIntIndexed(IntBiConsumer action)
int in this IntSequence, with the index of each element passed
as the second parameter in the action.