@FunctionalInterface public interface LongSequence extends LongList
Iterable sequence of long values with Stream-like operations for refining,
transforming and collating the list of longs.| Modifier and Type | Method and Description |
|---|---|
default boolean |
all(java.util.function.LongPredicate predicate) |
default boolean |
any(java.util.function.LongPredicate predicate) |
default LongSequence |
append(java.lang.Iterable<java.lang.Long> iterable)
Append the
Longs in the given Iterable to the end of this LongSequence. |
default LongSequence |
append(java.util.Iterator<java.lang.Long> iterator)
Append the
Longs in the given Iterator to the end of this LongSequence. |
default LongSequence |
append(long... longs)
Append the given
longs to the end of this LongSequence. |
default LongSequence |
append(LongIterable iterable)
|
default LongSequence |
append(java.util.stream.LongStream stream)
Append the
long values of the given LongStream to the end of this LongSequence. |
default LongSequence |
append(java.util.PrimitiveIterator.OfLong iterator)
Append the
longs in the given PrimitiveIterator.OfLong to the end of this LongSequence. |
default LongSequence |
append(java.util.stream.Stream<java.lang.Long> stream)
Append the
Longs in the given Stream to the end of this LongSequence. |
default java.util.OptionalLong |
at(int index) |
default java.util.OptionalLong |
at(int index,
java.util.function.LongPredicate predicate) |
default Sequence<LongSequence> |
batch(int size)
Batch the elements of this
LongSequence into a sequence of LongSequences of distinct elements,
each with the given batch size. |
default Sequence<LongSequence> |
batch(LongBiPredicate predicate)
Batch the elements of this
LongSequence into a sequence of LongSequences of distinct elements,
where the given predicate determines where to split the lists of partitioned elements. |
default Sequence<java.lang.Long> |
box()
Map the
longs in this LongSequence to their boxed Long counterparts. |
static LongSequence |
cache(java.lang.Iterable<java.lang.Long> iterable)
Create a
LongSequence from a cached copy of an Iterable of Long values. |
static LongSequence |
cache(java.util.Iterator<java.lang.Long> iterator)
Create a
LongSequence from a cached copy of an Iterator of Longs. |
static LongSequence |
cache(LongIterable iterable)
Create a
LongSequence from a cached copy of an LongIterable. |
static LongSequence |
cache(java.util.stream.LongStream stream)
Create a
LongSequence from a cached copy of a LongStream. |
static LongSequence |
cache(java.util.PrimitiveIterator.OfLong iterator)
Create a
LongSequence from a cached copy of a PrimitiveIterator.OfLong. |
static LongSequence |
cache(java.util.stream.Stream<java.lang.Long> stream)
Create a
LongSequence from a cached copy of a Stream of Longs. |
default <C> C |
collect(java.util.function.Supplier<? extends C> constructor,
java.util.function.ObjLongConsumer<? super C> adder)
Collect this
LongSequence into an arbitrary container using the given constructor and adder. |
default <C> C |
collectInto(C result,
java.util.function.ObjLongConsumer<? super C> adder)
Collect this
LongSequence into the given container using the given adder. |
default <U extends LongCollection> |
collectInto(U collection)
Collect this
LongSequence into the given LongCollection. |
static LongSequence |
decreasingFrom(long start)
A decreasing
LongSequence of long values starting at the given value. |
default LongSequence |
distinct() |
static LongSequence |
empty()
Create empty
LongSequence with no contents. |
default LongSequence |
endingAt(long terminal)
Terminate this
LongSequence sequence at the given element, including it as the last element in this
LongSequence sequence. |
default LongSequence |
endingAt(java.util.function.LongPredicate terminal)
Terminate this
LongSequence sequence at the element that satisfies the given predicate, including the
element as the last element in this LongSequence sequence. |
default LongSequence |
excluding(long... elements) |
default LongSequence |
filter(java.util.function.LongPredicate predicate)
Filter the elements in this
LongSequence, keeping only the elements that match the given
LongPredicate. |
default LongSequence |
filterBack(long firstPrevious,
LongBiPredicate predicate)
Filter this
LongSequence to another sequence of longs while peeking at the previous value in the
sequence. |
default LongSequence |
filterForward(long lastNext,
LongBiPredicate predicate)
Filter this
LongSequence to another sequence of longs while peeking at the next long in the sequence. |
default LongSequence |
filterIndexed(LongIntPredicate predicate)
Filter the elements in this
LongSequence, keeping only the elements that match the given
LongIntPredicate, which is passed each double together with its index in the sequence. |
default java.util.OptionalLong |
first() |
default java.util.OptionalLong |
first(java.util.function.LongPredicate predicate) |
default void |
forEachLongIndexed(LongIntConsumer action)
Perform the given action for each
long in this LongSequence, with the index of each element
passed as the second parameter in the action. |
static LongSequence |
from(java.lang.Iterable<java.lang.Long> iterable)
Create a
LongSequence from an Iterable of Long values. |
static LongSequence |
from(long[] ls,
int size)
Create a
LongSequence with the given longs, limited to the given size. |
static LongSequence |
from(long[] ls,
int offset,
int size)
Create a
LongSequence with the given longs, reading from the given offset and limited to the
given size. |
static LongSequence |
from(LongIterable iterable)
Create a
LongSequence from a LongIterable. |
static LongSequence |
generate(java.util.function.LongSupplier supplier) |
default LongSequence |
including(long... elements) |
static LongSequence |
increasingFrom(long start)
An increasing
LongSequence of long values starting at the given value. |
default LongSequence |
interleave(LongIterable that)
Interleave the elements in this
LongSequence with those of the given LongIterable, stopping when
either sequence finishes. |
default boolean |
isEmpty() |
default java.lang.String |
join(java.lang.String delimiter)
Join this
LongSequence 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
LongSequence into a string separated by the given delimiter, with the given prefix and suffix. |
default java.util.OptionalLong |
last() |
default java.util.OptionalLong |
last(java.util.function.LongPredicate predicate) |
default LongSequence |
limit(int limit)
Limit the maximum number of
longs returned by this LongSequence. |
default LongSequence |
map(java.util.function.LongUnaryOperator mapper)
Map the
longs in this LongSequence to another set of longs specified by the given
mapper function. |
default LongSequence |
mapBack(long firstPrevious,
java.util.function.LongBinaryOperator mapper)
Map this
LongSequence to another sequence of longs while peeking at the previous long in the
sequence. |
default LongSequence |
mapForward(long lastNext,
java.util.function.LongBinaryOperator mapper)
Map this
LongSequence to another sequence of longs while peeking at the next long in the
sequence. |
default LongSequence |
mapIndexed(LongIntToLongFunction mapper)
Map the
longs in this LongSequence to another set of longs specified by the given
mapper function, while providing the current index to the mapper. |
default java.util.OptionalLong |
max() |
default java.util.OptionalLong |
min() |
static LongSequence |
multiGenerate(java.util.function.Supplier<? extends java.util.function.LongSupplier> supplierSupplier) |
static LongSequence |
negative()
A
Sequence of all the negative long values starting at -1 and ending at
Long.MIN_VALUE. |
static LongSequence |
negativeFromZero()
A
LongSequence of all the negative long values starting at 0 and ending at
Long.MIN_VALUE inclusive. |
default boolean |
none(java.util.function.LongPredicate predicate) |
static LongSequence |
of(long... ls)
Create a
LongSequence with the given longs. |
static LongSequence |
once(java.util.Iterator<java.lang.Long> iterator)
Create a once-only
LongSequence from an Iterator of Long values. |
static LongSequence |
once(java.util.stream.LongStream stream)
Create a once-only @code Sequence} from a
LongStream of items. |
static LongSequence |
once(java.util.PrimitiveIterator.OfLong iterator)
Create a once-only
LongSequence from a PrimitiveIterator.OfLong of long values. |
static LongSequence |
once(java.util.stream.Stream<java.lang.Long> stream)
Create a once-only
Sequence from a Stream of items. |
default LongSequence |
peek(java.util.function.LongConsumer action)
Allow the given
LongConsumer to see each element in this LongSequence as it is traversed. |
default LongSequence |
peekIndexed(LongIntConsumer action)
Allow the given
LongIntConsumer to see each element together with its index in this LongSequence
as it is traversed. |
static LongSequence |
positive()
A
Sequence of all the positive long values starting at 1 and ending at
Long.MAX_VALUE inclusive. |
static LongSequence |
positiveFromZero()
A
LongSequence of all the positive long values starting at 0 and ending at
Long.MAX_VALUE inclusive. |
default LongSequence |
prefix(long... cs)
Prefix the longs in this
LongSequence with the given longs. |
static LongSequence |
random() |
static LongSequence |
random(long upper) |
static LongSequence |
random(long lower,
long upper) |
static LongSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier) |
static LongSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
long upper) |
static LongSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
long lower,
long upper) |
static LongSequence |
range(long start,
long end)
A
LongSequence of all the long values between the given start and end positions, inclusive. |
static LongSequence |
range(long start,
long end,
long step)
A
LongSequence of the long values between the given start and end positions, stepping with
the given step. |
static LongSequence |
recurse(long seed,
java.util.function.LongUnaryOperator op)
Returns a
LongSequence 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.OptionalLong |
reduce(java.util.function.LongBinaryOperator operator)
Reduce this
LongSequence into a single long by iteratively applying the given binary operator to
the current result and each long in the sequence. |
default long |
reduce(long identity,
java.util.function.LongBinaryOperator operator)
Reduce this
LongSequence into a single long by iteratively applying the given binary operator to
the current result and each long in the sequence, starting with the given identity as the initial
result. |
default LongSequence |
repeat()
Repeat this sequence of longs forever, looping back to the beginning when the iterator runs out of longs.
|
default LongSequence |
repeat(int times)
Repeat this sequence of longs x times, looping back to the beginning when the iterator runs out of longs.
|
default LongSequence |
reverse() |
default int |
size() |
default LongSequence |
skip(int skip)
Skip a set number of
longs in this LongSequence. |
default LongSequence |
skipTail(int skip)
Skip a set number of
longs at the end of this LongSequence. |
default LongSequence |
sorted() |
default Sequence<LongSequence> |
split(long element)
Split the
ints of this IntSequence into a sequence of IntSequences of distinct elements,
around the given int. |
default Sequence<LongSequence> |
split(java.util.function.LongPredicate predicate)
Split the
longs of this LongSequence into a sequence of LongSequences of distinct
elements, where the given predicate determines which longs to split the partitioned elements around. |
default LongSequence |
startingAfter(long element)
Begin this
LongSequence just after the given element is encountered, not including the element in the
LongSequence. |
default LongSequence |
startingAfter(java.util.function.LongPredicate predicate)
Begin this
LongSequence just after the given predicate is satisfied, not including the element that
satisfies the predicate in the LongSequence. |
default LongSequence |
startingFrom(long element)
Begin this
LongSequence when the given element is encountered, including the element as the first
element
in the LongSequence. |
default LongSequence |
startingFrom(java.util.function.LongPredicate predicate)
Begin this
LongSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the LongSequence. |
default LongSequence |
step(int step)
Skip x number of steps in between each invocation of the iterator of this
LongSequence. |
static LongSequence |
steppingFrom(long start,
long step)
A
LongSequence of all the long values starting at the given value and stepping with the given
step. |
default LongSequence |
suffix(long... cs)
Suffix the longs in this
LongSequence with the given longs. |
default CharSeq |
toChars()
Convert this sequence of longs to a sequence of chars corresponding to the downcast char value of each long.
|
default CharSeq |
toChars(LongToCharFunction mapper)
Convert this sequence of longs to a sequence of chars using the given converter function.
|
default <U extends LongCollection> |
toCollection(java.util.function.Supplier<? extends U> constructor)
Collect this
LongSequence into an LongCollection of the type determined by the given constructor. |
default DoubleSequence |
toDoubles()
Convert this sequence of longs to a sequence of doubles corresponding to the cast double value of each long.
|
default DoubleSequence |
toDoubles(java.util.function.LongToDoubleFunction mapper)
Convert this sequence of longs to a sequence of doubles using the given converter function.
|
default IntSequence |
toInts()
Convert this sequence of longs to a sequence of ints corresponding to the downcast integer value of each long.
|
default IntSequence |
toInts(java.util.function.LongToIntFunction mapper)
Convert this sequence of longs to a sequence of ints using the given converter function.
|
default LongList |
toList()
Collect the elements in this
LongSequence into an LongList. |
default LongList |
toList(java.util.function.Supplier<? extends LongList> constructor)
Collect the elements in this
LongSequence into an LongList of the type determined by the given
constructor. |
default <T> Sequence<T> |
toSequence(java.util.function.LongFunction<T> mapper)
|
default LongSet |
toSet()
Collect the elements in this
LongSequence into an LongSet. |
default <S extends LongSet> |
toSet(java.util.function.Supplier<? extends S> constructor)
Collect the elements in this
LongSequence into an LongSet of the type determined by the given
constructor. |
default LongSortedSet |
toSortedSet()
Collect the elements in this
LongSequence into an LongSortedSet. |
default LongSequence |
until(long terminal)
Terminate this
LongSequence sequence before the given element, with the previous element as the last
element in this LongSequence sequence. |
default LongSequence |
until(java.util.function.LongPredicate terminal)
Terminate this
LongSequence sequence before the element that satisfies the given predicate, with the
previous
element as the last element in this LongSequence sequence. |
default Sequence<LongSequence> |
window(int window)
Window the elements of this
LongSequence into a sequence of LongSequences of elements, each with
the size of the given window. |
default Sequence<LongSequence> |
window(int window,
int step)
Window the elements of this
LongSequence into a sequence of LongSequences of elements, each with
the size of the given window, stepping step elements between each window. |
add, add, addAll, addAll, addAllLongs, addAllLongs, addAllLongsAt, addAllLongsAt, addLong, addLongAt, binarySearch, clear, contains, containsAll, copy, get, getLong, indexOf, indexOfLong, lastIndexOf, lastIndexOfLong, listIterator, listIterator, remove, remove, removeAll, removeIf, removeLongAt, replaceAll, replaceAllLongs, retainAll, set, setLong, sort, sortLongs, sortLongs, spliterator, subList, toArray, toArraytoLongArraycontainsAllLongs, containsAllLongs, containsAnyLongs, containsAnyLongs, containsLong, forEach, forEachLong, from, longStream, once, parallelLongStream, removeAllLongs, removeAllLongs, removeLong, removeLongsIf, retainAllLongs, retainAllLongs, sequencestatic LongSequence empty()
LongSequence with no contents.static LongSequence of(long... ls)
LongSequence with the given longs.of in interface LongIterableof in interface LongListLongList of the given elements.static LongSequence from(long[] ls, int size)
LongSequence with the given longs, limited to the given size.static LongSequence from(long[] ls, int offset, int size)
LongSequence with the given longs, reading from the given offset and limited to the
given size.static LongSequence from(LongIterable iterable)
LongSequence from a LongIterable.cache(LongIterable)static LongSequence from(java.lang.Iterable<java.lang.Long> iterable)
LongSequence from an Iterable of Long values.from in interface LongIterablecache(Iterable)static LongSequence once(java.util.PrimitiveIterator.OfLong iterator)
LongSequence from a PrimitiveIterator.OfLong of long values. Note that LongSequences created from PrimitiveIterator.OfLongs cannot be passed over more than once. Further
attempts will register the LongSequence as empty.once in interface LongIterablecache(PrimitiveIterator.OfLong)static LongSequence once(java.util.Iterator<java.lang.Long> iterator)
LongSequence from an Iterator of Long values. Note that
LongSequences created from Iterators cannot be passed over more than once. Further attempts will
register the LongSequence as empty.cache(Iterator)static LongSequence once(java.util.stream.LongStream stream)
LongStream of items. Note that Sequences created from
LongStreams cannot be passed over more than once. Further attempts will register the
LongSequence as empty.java.lang.IllegalStateException - if the Stream is exhausted.cache(LongStream)static LongSequence once(java.util.stream.Stream<java.lang.Long> stream)
Sequence from a Stream of items. Note that Sequences created from
Streams cannot be passed over more than once. Further attempts will register the LongSequence as
empty.java.lang.IllegalStateException - if the Stream is exhausted.cache(Stream)static LongSequence cache(java.util.PrimitiveIterator.OfLong iterator)
LongSequence from a cached copy of a PrimitiveIterator.OfLong.cache(Iterator),
cache(LongStream),
cache(Stream),
cache(LongIterable),
cache(Iterable),
once(PrimitiveIterator.OfLong)static LongSequence cache(java.util.Iterator<java.lang.Long> iterator)
LongSequence from a cached copy of an Iterator of Longs.cache(PrimitiveIterator.OfLong),
cache(LongStream),
cache(Stream),
cache(LongIterable),
cache(Iterable),
once(Iterator)static LongSequence cache(java.util.stream.LongStream stream)
LongSequence from a cached copy of a LongStream.cache(Stream),
cache(LongIterable),
cache(Iterable),
cache(PrimitiveIterator.OfLong),
cache(Iterator),
once(LongStream)static LongSequence cache(java.util.stream.Stream<java.lang.Long> stream)
LongSequence from a cached copy of a Stream of Longs.cache(LongStream),
cache(LongIterable),
cache(Iterable),
cache(PrimitiveIterator.OfLong),
cache(Iterator),
once(Stream)static LongSequence cache(LongIterable iterable)
LongSequence from a cached copy of an LongIterable.cache(Iterable),
cache(LongStream),
cache(Stream),
cache(PrimitiveIterator.OfLong),
cache(Iterator),
from(LongIterable)static LongSequence cache(java.lang.Iterable<java.lang.Long> iterable)
LongSequence from a cached copy of an Iterable of Long values.cache(LongIterable),
cache(LongStream),
cache(Stream),
cache(PrimitiveIterator.OfLong),
cache(Iterator),
from(Iterable)static LongSequence positive()
Sequence of all the positive long values starting at 1 and ending at
Long.MAX_VALUE inclusive.static LongSequence positiveFromZero()
LongSequence of all the positive long values starting at 0 and ending at
Long.MAX_VALUE inclusive.static LongSequence increasingFrom(long start)
LongSequence of long values starting at the given value. This sequence never
terminates but will wrap to Long.MIN_VALUE when passing Long.MAX_VALUE.static LongSequence negative()
Sequence of all the negative long values starting at -1 and ending at
Long.MIN_VALUE.static LongSequence negativeFromZero()
LongSequence of all the negative long values starting at 0 and ending at
Long.MIN_VALUE inclusive.static LongSequence decreasingFrom(long start)
LongSequence of long values starting at the given value. This sequence never
terminates but will wrap to Long.MAX_VALUE when passing Long.MIN_VALUE.static LongSequence steppingFrom(long start, long step)
LongSequence of all the long 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 Long.MAX_VALUE or Long.MIN_VALUE.static LongSequence range(long start, long end)
LongSequence of all the long values between the given start and end positions, inclusive.static LongSequence range(long start, long end, long step)
LongSequence of the long 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(long, long),
steppingFrom(long, long),
increasingFrom(long),
decreasingFrom(long),
positive(),
positiveFromZero(),
negative(),
negativeFromZero()static LongSequence recurse(long seed, java.util.function.LongUnaryOperator op)
LongSequence 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 LongSequence sequence never terminates naturally.LongSequence sequence produced by recursively applying the given operation to the given seedgenerate(LongSupplier),
endingAt(long),
until(long)static LongSequence generate(java.util.function.LongSupplier supplier)
LongSequence that is generated from the given supplier and thus never terminates.recurse(long, LongUnaryOperator),
endingAt(long),
until(long)static LongSequence multiGenerate(java.util.function.Supplier<? extends java.util.function.LongSupplier> supplierSupplier)
LongSequence where each List.iterator() is generated by polling for a supplier and then
using it to generate the sequence of longs. The sequence never terminates.recurse(long, LongUnaryOperator),
endingAt(long),
until(long)static LongSequence random()
LongSequence of random longs that never terminates. Each run of this LongSequence's
List.iterator() will produce a new random sequence of longs. This method is equivalent to random
(Random::new).random(Supplier),
Random.nextLong()static LongSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier)
LongSequence of random longs 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.nextLong()static LongSequence random(long upper)
LongSequence of random longs between 0, inclusive, and the upper bound, exclusive,
that never terminates. Each run of this LongSequence's List.iterator() will produce a new random
sequence of longs. This method is equivalent to random(Random::new, upper.random(Supplier, long),
Random.nextDouble()static LongSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, long upper)
LongSequence of random longs 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(long),
Random.nextDouble()static LongSequence random(long lower, long upper)
LongSequence of random longs between the lower bound, inclusive, and upper bound, exclusive,
that never terminates. Each run of this LongSequence's List.iterator() will produce a new random
sequence of longs. This method is equivalent to random(Random::new, lower, upper.random(Supplier, long, long),
Random.nextDouble()static LongSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, long lower, long upper)
LongSequence of random longs 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(long, long),
Random.nextDouble()default LongSequence until(long terminal)
LongSequence sequence before the given element, with the previous element as the last
element in this LongSequence sequence.default LongSequence endingAt(long terminal)
LongSequence sequence at the given element, including it as the last element in this
LongSequence sequence.default LongSequence until(java.util.function.LongPredicate terminal)
LongSequence sequence before the element that satisfies the given predicate, with the
previous
element as the last element in this LongSequence sequence.default LongSequence endingAt(java.util.function.LongPredicate terminal)
LongSequence sequence at the element that satisfies the given predicate, including the
element as the last element in this LongSequence sequence.default LongSequence startingAfter(long element)
LongSequence just after the given element is encountered, not including the element in the
LongSequence.startingAfter(LongPredicate),
startingFrom(long)default LongSequence startingFrom(long element)
LongSequence when the given element is encountered, including the element as the first
element
in the LongSequence.startingFrom(LongPredicate),
startingAfter(long)default LongSequence startingAfter(java.util.function.LongPredicate predicate)
LongSequence just after the given predicate is satisfied, not including the element that
satisfies the predicate in the LongSequence.startingAfter(long),
startingFrom(LongPredicate)default LongSequence startingFrom(java.util.function.LongPredicate predicate)
LongSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the LongSequence.startingFrom(long),
startingAfter(LongPredicate)default LongSequence map(java.util.function.LongUnaryOperator mapper)
longs in this LongSequence to another set of longs specified by the given
mapper function.default LongSequence mapIndexed(LongIntToLongFunction mapper)
longs in this LongSequence to another set of longs specified by the given
mapper function, while providing the current index to the mapper.default LongSequence mapBack(long firstPrevious, java.util.function.LongBinaryOperator mapper)
LongSequence to another sequence of longs while peeking at the previous long in the
sequence.
The mapper has access to the previous long and the current long in the iteration. If the current long 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 LongSequence mapForward(long lastNext, java.util.function.LongBinaryOperator mapper)
LongSequence to another sequence of longs while peeking at the next long in the
sequence.
The mapper has access to the current long and the next long in the iteration. If the current long 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 Sequence<java.lang.Long> box()
longs in this LongSequence to their boxed Long counterparts.default <T> Sequence<T> toSequence(java.util.function.LongFunction<T> mapper)
default LongSequence skip(int skip)
longs in this LongSequence.default LongSequence skipTail(int skip)
longs at the end of this LongSequence.default LongSequence limit(int limit)
longs returned by this LongSequence.default LongSequence append(long... longs)
longs to the end of this LongSequence.default LongSequence append(LongIterable iterable)
default LongSequence append(java.lang.Iterable<java.lang.Long> iterable)
Longs in the given Iterable to the end of this LongSequence.default LongSequence append(java.util.PrimitiveIterator.OfLong iterator)
longs in the given PrimitiveIterator.OfLong to the end of this LongSequence.
The appended longs will only be available on the first traversal of the resulting LongSequence.
default LongSequence append(java.util.Iterator<java.lang.Long> iterator)
Longs in the given Iterator to the end of this LongSequence.
The appended Longs will only be available on the first traversal of the resulting LongSequence.
default LongSequence append(java.util.stream.LongStream stream)
long values of the given LongStream to the end of this LongSequence.
The appended longs will only be available on the first traversal of the resulting LongSequence.
default LongSequence append(java.util.stream.Stream<java.lang.Long> stream)
Longs in the given Stream to the end of this LongSequence.
The appended Longs will only be available on the first traversal of the resulting LongSequence.
default LongSequence filter(java.util.function.LongPredicate predicate)
LongSequence, keeping only the elements that match the given
LongPredicate.default LongSequence filterIndexed(LongIntPredicate predicate)
LongSequence, keeping only the elements that match the given
LongIntPredicate, which is passed each double together with its index in the sequence.default LongSequence filterBack(long firstPrevious, LongBiPredicate predicate)
LongSequence to another sequence of longs while peeking at the previous value in the
sequence.
The predicate has access to the previous long and the current long in the iteration. If the current long 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 LongSequence filterForward(long lastNext, LongBiPredicate predicate)
LongSequence to another sequence of longs while peeking at the next long in the sequence.
The predicate has access to the current long and the next long in the iteration. If the current long 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 LongSequence including(long... elements)
LongSequence containing only the longs found in the given target array.default LongSequence excluding(long... elements)
LongSequence containing only the longs not found in the given target array.default LongList toList(java.util.function.Supplier<? extends LongList> constructor)
LongSequence into an LongList of the type determined by the given
constructor.default LongSet toSet()
LongSequence into an LongSet.toSortedSet()default <S extends LongSet> S toSet(java.util.function.Supplier<? extends S> constructor)
LongSequence into an LongSet of the type determined by the given
constructor.default LongSortedSet toSortedSet()
LongSequence into an LongSortedSet.default <U extends LongCollection> U toCollection(java.util.function.Supplier<? extends U> constructor)
LongSequence into an LongCollection of the type determined by the given constructor.default <C> C collect(java.util.function.Supplier<? extends C> constructor,
java.util.function.ObjLongConsumer<? super C> adder)
LongSequence into an arbitrary container using the given constructor and adder.default <U extends LongCollection> U collectInto(U collection)
LongSequence into the given LongCollection.default <C> C collectInto(C result,
java.util.function.ObjLongConsumer<? super C> adder)
LongSequence into the given container using the given adder.default java.lang.String join(java.lang.String delimiter)
LongSequence 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)
LongSequence into a string separated by the given delimiter, with the given prefix and suffix.default java.util.OptionalLong reduce(java.util.function.LongBinaryOperator operator)
LongSequence into a single long by iteratively applying the given binary operator to
the current result and each long in the sequence.default long reduce(long identity,
java.util.function.LongBinaryOperator operator)
LongSequence into a single long by iteratively applying the given binary operator to
the current result and each long in the sequence, starting with the given identity as the initial
result.default java.util.OptionalLong first()
LongSequence or an empty OptionalLong if there are no
longs in the LongSequence.default java.util.OptionalLong last()
LongSequence or an empty OptionalLong if there are no
longs in the LongSequence.default java.util.OptionalLong at(int index)
long at the given index, or an empty OptionalLong if the LongSequence is
smaller than the index.default java.util.OptionalLong first(java.util.function.LongPredicate predicate)
LongSequence matching the given predicate, or an empty
OptionalLong if there are no matching longs in the LongSequence.filter(LongPredicate),
at(int, LongPredicate)default java.util.OptionalLong last(java.util.function.LongPredicate predicate)
LongSequence matching the given predicate, or an empty
OptionalLong if there are no matching longs in the LongSequence.filter(LongPredicate),
at(int, LongPredicate)default java.util.OptionalLong at(int index,
java.util.function.LongPredicate predicate)
long at the given index out of longs matching the given predicate, or an empty
OptionalLong if the matching LongSequence is smaller than the index.filter(LongPredicate)default LongSequence step(int step)
LongSequence.default LongSequence distinct()
LongSequence where each item occurs only once, the first time it is encountered.default java.util.OptionalLong min()
LongSequence.default java.util.OptionalLong max()
LongSequence.default int size()
size in interface java.util.Collection<java.lang.Long>size in interface java.util.List<java.lang.Long>LongSequence.default boolean all(java.util.function.LongPredicate predicate)
LongSequence satisfy the given predicate, false otherwise.default boolean none(java.util.function.LongPredicate predicate)
LongSequence satisfy the given predicate, false otherwise.default boolean any(java.util.function.LongPredicate predicate)
LongSequence satisfy the given predicate, false otherwise.default LongSequence peek(java.util.function.LongConsumer action)
LongConsumer to see each element in this LongSequence as it is traversed.default LongSequence peekIndexed(LongIntConsumer action)
LongIntConsumer to see each element together with its index in this LongSequence
as it is traversed.default LongSequence sorted()
LongSequence sorted according to the natural order of the long values.reverse()default LongSequence prefix(long... cs)
LongSequence with the given longs.default LongSequence suffix(long... cs)
LongSequence with the given longs.default LongSequence interleave(LongIterable that)
LongSequence with those of the given LongIterable, stopping when
either sequence finishes.default LongSequence reverse()
LongSequence which iterates over this LongSequence in reverse order.sorted()default CharSeq toChars()
default IntSequence toInts()
default DoubleSequence toDoubles()
default CharSeq toChars(LongToCharFunction mapper)
default IntSequence toInts(java.util.function.LongToIntFunction mapper)
default DoubleSequence toDoubles(java.util.function.LongToDoubleFunction mapper)
default LongSequence repeat()
The resulting sequence will never terminate if this sequence is non-empty.
default LongSequence repeat(int times)
default Sequence<LongSequence> window(int window)
LongSequence into a sequence of LongSequences 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
LongSequence may be shorter than the window. This is equivalent to window(window, 1).default Sequence<LongSequence> window(int window, int step)
LongSequence into a sequence of LongSequences 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<LongSequence> batch(int size)
LongSequence into a sequence of LongSequences of distinct elements,
each with the given batch size. This is equivalent to window(size, size).default Sequence<LongSequence> batch(LongBiPredicate predicate)
LongSequence into a sequence of LongSequences 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<LongSequence> split(long 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<LongSequence> split(java.util.function.LongPredicate predicate)
longs of this LongSequence into a sequence of LongSequences of distinct
elements, where the given predicate determines which longs to split the partitioned elements around. The
longs matching the predicate are not included in the result.default boolean isEmpty()
isEmpty in interface java.util.Collection<java.lang.Long>isEmpty in interface java.util.List<java.lang.Long>isEmpty in interface LongCollectionisEmpty in interface LongIterableisEmpty in interface LongListLongSequence is empty, false otherwise.default void forEachLongIndexed(LongIntConsumer action)
long in this LongSequence, with the index of each element
passed as the second parameter in the action.