@FunctionalInterface public interface DoubleSequence extends DoubleIterable
Iterable
sequence of double
values with Stream
-like operations for refining,
transforming and collating the list of doubles.Modifier and Type | Method and Description |
---|---|
default boolean |
all(java.util.function.DoublePredicate predicate) |
default boolean |
any(java.util.function.DoublePredicate predicate) |
default DoubleSequence |
append(double... doubles)
Append the given
doubles to the end of this DoubleSequence . |
default DoubleSequence |
append(DoubleIterable that)
|
default DoubleSequence |
append(java.util.stream.DoubleStream stream)
Append the
double values of the given DoubleStream to the end of this DoubleSequence . |
default DoubleSequence |
append(java.lang.Iterable<java.lang.Double> iterable)
Append the
Double s in the given Iterable to the end of this DoubleSequence . |
default DoubleSequence |
append(java.util.Iterator<java.lang.Double> iterator)
Append the
Double s in the given Iterator to the end of this DoubleSequence . |
default DoubleSequence |
append(java.util.PrimitiveIterator.OfDouble iterator)
Append the
doubles in the given PrimitiveIterator.OfDouble to the end of this
DoubleSequence . |
default DoubleSequence |
append(java.util.stream.Stream<java.lang.Double> stream)
Append the
Double s in the given Stream to the end of this DoubleSequence . |
default java.util.OptionalDouble |
at(long index) |
default java.util.OptionalDouble |
at(long index,
java.util.function.DoublePredicate predicate) |
default Sequence<DoubleSequence> |
batch(DoubleBiPredicate predicate)
Batch the elements of this
DoubleSequence into a sequence of DoubleSequence s of distinct
elements,
where the given predicate determines where to split the lists of partitioned elements. |
default Sequence<DoubleSequence> |
batch(int size)
Batch the elements of this
DoubleSequence into a sequence of DoubleSequence s of distinct
elements,
each with the given batch size. |
default Sequence<java.lang.Double> |
box()
Map the
doubles in this DoubleSequence to their boxed Double counterparts. |
static DoubleSequence |
cache(DoubleIterable iterable)
Create a
DoubleSequence from a cached copy of an DoubleIterable . |
static DoubleSequence |
cache(java.util.stream.DoubleStream stream)
Create a
DoubleSequence from a cached copy of a DoubleStream . |
static DoubleSequence |
cache(java.lang.Iterable<java.lang.Double> iterable)
Create a
DoubleSequence from a cached copy of an Iterable of Double values. |
static DoubleSequence |
cache(java.util.Iterator<java.lang.Double> iterator)
Create a
DoubleSequence from a cached copy of an Iterator of Double s. |
static DoubleSequence |
cache(java.util.PrimitiveIterator.OfDouble iterator)
Create a
DoubleSequence from a cached copy of a PrimitiveIterator.OfDouble . |
static DoubleSequence |
cache(java.util.stream.Stream<java.lang.Double> stream)
Create a
DoubleSequence from a cached copy of a Stream of Double s. |
default void |
clear()
Remove all elements matched by this sequence using
Iterator.remove() . |
default <C> C |
collect(java.util.function.Supplier<? extends C> constructor,
java.util.function.ObjDoubleConsumer<? super C> adder)
Collect this
DoubleSequence into an arbitrary container using the given constructor and adder. |
default <C> C |
collectInto(C result,
java.util.function.ObjDoubleConsumer<? super C> adder)
Collect this
DoubleSequence into the given container using the given adder. |
default boolean |
contains(double d,
double precision) |
default boolean |
containsAll(double precision,
double... items) |
default boolean |
containsAny(double precision,
double... items) |
default long |
count()
Deprecated.
Use
size() instead. |
static DoubleSequence |
empty()
Create empty
DoubleSequence with no contents. |
default DoubleSequence |
endingAt(double terminal,
double accuracy)
Terminate this
DoubleSequence at the given element compared to the given accuracy, including it as the
last element in this DoubleSequence . |
default DoubleSequence |
endingAt(java.util.function.DoublePredicate terminal)
Terminate this
DoubleSequence at the element that satisfies the given predicate, including the
element as the last element in this DoubleSequence . |
default DoubleSequence |
excluding(double precision,
double... elements) |
default DoubleSequence |
filter(java.util.function.DoublePredicate predicate)
Filter the elements in this
DoubleSequence , keeping only the elements that match the given
DoublePredicate . |
default DoubleSequence |
filterBack(double firstPrevious,
DoubleBiPredicate predicate)
Filter this
DoubleSequence to another sequence of doubles while peeking at the previous value in the
sequence. |
default DoubleSequence |
filterForward(double lastNext,
DoubleBiPredicate predicate)
Filter this
DoubleSequence to another sequence of doubles while peeking at the next double in the
sequence. |
default DoubleSequence |
filterIndexed(DoubleLongPredicate predicate)
Filter the elements in this
DoubleSequence , keeping only the elements that match the given
DoubleLongPredicate , which is passed each double together with its index in the sequence. |
default java.util.OptionalDouble |
first() |
default java.util.OptionalDouble |
first(java.util.function.DoublePredicate predicate) |
default void |
forEachDoubleIndexed(DoubleLongConsumer action)
Perform the given action for each
double in this DoubleSequence , with the index of each element passed
as the second parameter in the action. |
static DoubleSequence |
from(DoubleIterable iterable)
Create a
DoubleSequence from a DoubleIterable . |
static DoubleSequence |
from(java.util.stream.DoubleStream stream)
Deprecated.
Use
once(DoubleStream) instead. |
static DoubleSequence |
from(java.lang.Iterable<java.lang.Double> iterable)
Create a
DoubleSequence from an Iterable of Double values. |
static DoubleSequence |
from(java.util.Iterator<java.lang.Double> iterator)
Deprecated.
Use
once(Iterator) instead. |
static DoubleSequence |
from(java.util.PrimitiveIterator.OfDouble iterator)
Deprecated.
Use
once(PrimitiveIterator.OfDouble) instead. |
static DoubleSequence |
from(java.util.stream.Stream<java.lang.Double> stream)
Deprecated.
Use
once(Stream) instead. |
static DoubleSequence |
generate(java.util.function.DoubleSupplier supplier) |
default DoubleSequence |
including(double precision,
double... elements) |
default DoubleSequence |
interleave(DoubleIterable that)
Interleave the elements in this
DoubleSequence with those of the given DoubleIterable , stopping
when either sequence finishes. |
default boolean |
isEmpty() |
default java.lang.String |
join(java.lang.String delimiter)
Join this
DoubleSequence 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
DoubleSequence into a string separated by the given delimiter, with the given prefix and
suffix. |
default java.util.OptionalDouble |
last() |
default java.util.OptionalDouble |
last(java.util.function.DoublePredicate predicate) |
default DoubleSequence |
limit(long limit)
Limit the maximum number of
doubles returned by this DoubleSequence . |
default DoubleSequence |
map(java.util.function.DoubleUnaryOperator mapper)
Map the
doubles in this DoubleSequence to another set of doubles specified by the given
mapper function. |
default DoubleSequence |
mapBack(double firstPrevious,
java.util.function.DoubleBinaryOperator mapper)
Map this
DoubleSequence to another sequence of doubles while peeking at the previous value in the
sequence. |
default DoubleSequence |
mapForward(double lastNext,
java.util.function.DoubleBinaryOperator mapper)
Map this
DoubleSequence to another sequence of doubles while peeking at the next value in the
sequence. |
default DoubleSequence |
mapIndexed(DoubleLongToDoubleFunction mapper)
Map the
doubles in this DoubleSequence to another set of doubles specified by the given
mapper function, while providing the current index to the mapper. |
default java.util.OptionalDouble |
max() |
default java.util.OptionalDouble |
min() |
static DoubleSequence |
multiGenerate(java.util.function.Supplier<? extends java.util.function.DoubleSupplier> supplierSupplier) |
default boolean |
none(java.util.function.DoublePredicate predicate) |
static DoubleSequence |
of(double... ds)
Create a
DoubleSequence with the given doubles. |
static DoubleSequence |
once(java.util.stream.DoubleStream stream)
Create a once-only
DoubleSequence from a DoubleStream of items. |
static DoubleSequence |
once(java.util.Iterator<java.lang.Double> iterator)
Create a once-only
DoubleSequence from an Iterator of Double values. |
static DoubleSequence |
once(java.util.PrimitiveIterator.OfDouble iterator)
Create a once-only
DoubleSequence from a PrimitiveIterator.OfDouble of double values. |
static DoubleSequence |
once(java.util.stream.Stream<java.lang.Double> stream)
Create a once-only
DoubleSequence from a Stream of items. |
default DoubleSequence |
peek(java.util.function.DoubleConsumer action)
Allow the given
DoubleConsumer to see each element in this DoubleSequence as it is traversed. |
default DoubleSequence |
peekIndexed(DoubleLongConsumer action)
Allow the given
DoubleLongConsumer to see each element together with its index in this
DoubleSequence as it is traversed. |
default DoubleSequence |
prefix(double... xs)
Prefix the doubles in this
DoubleSequence with the given doubles. |
static DoubleSequence |
random() |
static DoubleSequence |
random(double upper) |
static DoubleSequence |
random(double lower,
double upper) |
static DoubleSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier) |
static DoubleSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
double upper) |
static DoubleSequence |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
double lower,
double upper) |
static DoubleSequence |
range(double start,
double end,
double step,
double accuracy)
A
DoubleSequence of all the Double values between the given start and end positions, inclusive,
using
the given step between iterations and the given accuracy to check whether the end value has occurred. |
static DoubleSequence |
recurse(double seed,
java.util.function.DoubleUnaryOperator op) |
default java.util.OptionalDouble |
reduce(java.util.function.DoubleBinaryOperator operator)
Reduce this
DoubleSequence into a single double by iteratively applying the given binary
operator to the current result and each double in the sequence. |
default double |
reduce(double identity,
java.util.function.DoubleBinaryOperator operator)
Reduce this
DoubleSequence into a single double by iteratively applying the given binary
operator to the current result and each double in the sequence, starting with the given identity as the
initial result. |
default void |
removeAll()
Deprecated.
Use
clear() instead. |
default DoubleSequence |
repeat()
Repeat this sequence of characters doubles, looping back to the beginning when the iterator runs out of doubles.
|
default DoubleSequence |
repeat(long times)
Repeat this sequence of doubles x times, looping back to the beginning when the iterator runs out of doubles.
|
default DoubleSequence |
reverse() |
default java.util.OptionalDouble |
second() |
default java.util.OptionalDouble |
second(java.util.function.DoublePredicate predicate) |
default long |
size() |
default DoubleSequence |
skip(long skip)
Skip a set number of
doubles in this DoubleSequence . |
default DoubleSequence |
skipTail(int skip)
Skip a set number of
doubles at the end of this DoubleSequence . |
default DoubleSequence |
sorted() |
default Sequence<DoubleSequence> |
split(double element)
Split the
doubles of this DoubleSequence into a sequence of DoubleSequence s of distinct
elements, around the given double . |
default Sequence<DoubleSequence> |
split(java.util.function.DoublePredicate predicate)
Split the
doubles of this DoubleSequence into a sequence of DoubleSequence s of distinct
elements, where the given predicate determines which doubles to split the partitioned elements around. |
default DoubleSequence |
startingAfter(double element,
double accuracy)
Begin this
DoubleSequence just after the given element is encountered, not including the element in the
DoubleSequence . |
default DoubleSequence |
startingAfter(java.util.function.DoublePredicate predicate)
Begin this
DoubleSequence just after the given predicate is satisfied, not including the element that
satisfies the predicate in the DoubleSequence . |
default DoubleSequence |
startingFrom(double element,
double accuracy)
Begin this
DoubleSequence when the given element is encountered, including the element as the first
element
in the DoubleSequence . |
default DoubleSequence |
startingFrom(java.util.function.DoublePredicate predicate)
Begin this
DoubleSequence when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the DoubleSequence . |
default DoubleSequence |
step(long step)
Skip x number of steps in between each invocation of the iterator of this
DoubleSequence . |
static DoubleSequence |
steppingFrom(double start,
double step)
A
DoubleSequence of all the Double values starting at the given value and ending at Double.MAX_VALUE . |
default DoubleSequence |
suffix(double... xs)
Suffix the doubles in this
DoubleSequence with the given doubles. |
default java.util.OptionalDouble |
third() |
default java.util.OptionalDouble |
third(java.util.function.DoublePredicate predicate) |
default double[] |
toArray()
Collect the doubles in this
DoubleSequence into an array. |
default IntSequence |
toInts()
Convert this sequence of doubles to a sequence of ints corresponding to the downcast integer value of each
double.
|
default IntSequence |
toInts(java.util.function.DoubleToIntFunction mapper)
Convert this sequence of doubles to a sequence of ints using the given converter function.
|
default LongSequence |
toLongs()
Convert this sequence of doubles to a sequence of longs corresponding to the downcast long value of each
double.
|
default LongSequence |
toLongs(java.util.function.DoubleToLongFunction mapper)
Convert this sequence of doubles to a sequence of longs using the given converter function.
|
default IntSequence |
toRoundedInts()
Convert this sequence of doubles to a sequence of ints corresponding to the downcast rounded int value of each
double.
|
default LongSequence |
toRoundedLongs()
Convert this sequence of doubles to a sequence of longs corresponding to the rounded long value of each
double.
|
default <T> Sequence<T> |
toSequence(java.util.function.DoubleFunction<T> mapper)
|
default DoubleSequence |
until(double terminal,
double accuracy)
Terminate this
DoubleSequence before the given element compared to the given accuracy, with the previous
element as the last element in this DoubleSequence . |
default DoubleSequence |
until(java.util.function.DoublePredicate terminal)
Terminate this
DoubleSequence before the element that satisfies the given predicate, with the
previous element as the last element in this DoubleSequence . |
default Sequence<DoubleSequence> |
window(int window)
Window the elements of this
DoubleSequence into a sequence of DoubleSequence s of elements, each
with
the size of the given window. |
default Sequence<DoubleSequence> |
window(int window,
int step)
Window the elements of this
DoubleSequence into a sequence of DoubleSequence s of elements, each
with
the size of the given window, stepping step elements between each window. |
forEach, forEachDouble, from, iterator, once
static DoubleSequence empty()
DoubleSequence
with no contents.static DoubleSequence of(double... ds)
DoubleSequence
with the given doubles.of
in interface DoubleIterable
static DoubleSequence from(DoubleIterable iterable)
DoubleSequence
from a DoubleIterable
.cache(DoubleIterable)
static DoubleSequence from(java.lang.Iterable<java.lang.Double> iterable)
DoubleSequence
from an Iterable
of Double
values.from
in interface DoubleIterable
cache(Iterable)
static DoubleSequence once(java.util.PrimitiveIterator.OfDouble iterator)
DoubleSequence
from a PrimitiveIterator.OfDouble
of double values. Note that
DoubleSequence
s created from PrimitiveIterator.OfDouble
s cannot be passed over more than once.
Further attempts will register the DoubleSequence
as empty.once
in interface DoubleIterable
cache(PrimitiveIterator.OfDouble)
static DoubleSequence once(java.util.Iterator<java.lang.Double> iterator)
DoubleSequence
from an Iterator
of Double
values. Note that
DoubleSequence
s created from Iterator
s cannot be passed over more than once. Further attempts
will register the DoubleSequence
as empty.cache(Iterator)
static DoubleSequence once(java.util.stream.DoubleStream stream)
DoubleSequence
from a DoubleStream
of items. Note that
DoubleSequence
s created from DoubleStream
s cannot be passed over more than once. Further
attempts will register the DoubleSequence
as empty.java.lang.IllegalStateException
- if the DoubleStream
is exhausted.cache(DoubleStream)
static DoubleSequence once(java.util.stream.Stream<java.lang.Double> stream)
DoubleSequence
from a Stream
of items. Note that DoubleSequence
s
created from Stream
s cannot be passed over more than once. Further attempts will register the
DoubleSequence
as empty.java.lang.IllegalStateException
- if the Stream
is exhausted.cache(Stream)
@Deprecated static DoubleSequence from(java.util.PrimitiveIterator.OfDouble iterator)
once(PrimitiveIterator.OfDouble)
instead.DoubleSequence
from a PrimitiveIterator.OfDouble
of double values. Note that
DoubleSequence
s created from PrimitiveIterator.OfDouble
s cannot be passed over more than once.
Further attempts will register the DoubleSequence
as empty.cache(PrimitiveIterator.OfDouble)
@Deprecated static DoubleSequence from(java.util.Iterator<java.lang.Double> iterator)
once(Iterator)
instead.DoubleSequence
from an Iterator
of Double
values. Note that
DoubleSequence
s created from Iterator
s cannot be passed over more than once. Further attempts
will register the DoubleSequence
as empty.cache(Iterator)
@Deprecated static DoubleSequence from(java.util.stream.DoubleStream stream)
once(DoubleStream)
instead.DoubleSequence
from a DoubleStream
of items. Note that
DoubleSequence
s created from DoubleStream
s cannot be passed over more than once. Further
attempts will register the DoubleSequence
as empty.java.lang.IllegalStateException
- if the DoubleStream
is exhausted.cache(DoubleStream)
@Deprecated static DoubleSequence from(java.util.stream.Stream<java.lang.Double> stream)
once(Stream)
instead.DoubleSequence
from a Stream
of items. Note that DoubleSequence
s
created from Stream
s cannot be passed over more than once. Further attempts will register the
DoubleSequence
as empty.java.lang.IllegalStateException
- if the Stream
is exhausted.cache(Stream)
static DoubleSequence cache(java.util.PrimitiveIterator.OfDouble iterator)
DoubleSequence
from a cached copy of a PrimitiveIterator.OfDouble
.cache(Iterator)
,
cache(DoubleStream)
,
cache(Stream)
,
cache(DoubleIterable)
,
cache(Iterable)
,
once(PrimitiveIterator.OfDouble)
static DoubleSequence cache(java.util.Iterator<java.lang.Double> iterator)
DoubleSequence
from a cached copy of an Iterator
of Double
s.cache(PrimitiveIterator.OfDouble)
,
cache(DoubleStream)
,
cache(Stream)
,
cache(DoubleIterable)
,
cache(Iterable)
,
once(Iterator)
static DoubleSequence cache(java.util.stream.DoubleStream stream)
DoubleSequence
from a cached copy of a DoubleStream
.cache(Stream)
,
cache(DoubleIterable)
,
cache(Iterable)
,
cache(PrimitiveIterator.OfDouble)
,
cache(Iterator)
,
once(DoubleStream)
static DoubleSequence cache(java.util.stream.Stream<java.lang.Double> stream)
DoubleSequence
from a cached copy of a Stream
of Double
s.cache(DoubleStream)
,
cache(DoubleIterable)
,
cache(Iterable)
,
cache(PrimitiveIterator.OfDouble)
,
cache(Iterator)
,
once(Stream)
static DoubleSequence cache(DoubleIterable iterable)
DoubleSequence
from a cached copy of an DoubleIterable
.cache(Iterable)
,
cache(DoubleStream)
,
cache(Stream)
,
cache(PrimitiveIterator.OfDouble)
,
cache(Iterator)
,
from(DoubleIterable)
static DoubleSequence cache(java.lang.Iterable<java.lang.Double> iterable)
DoubleSequence
from a cached copy of an Iterable
of Double
values.cache(DoubleIterable)
,
cache(DoubleStream)
,
cache(Stream)
,
cache(PrimitiveIterator.OfDouble)
,
cache(Iterator)
,
from(Iterable)
static DoubleSequence steppingFrom(double start, double step)
DoubleSequence
of all the Double
values starting at the given value and ending at Double.MAX_VALUE
.range(double, double, double, double)
static DoubleSequence range(double start, double end, double step, double accuracy)
DoubleSequence
of all the Double
values between the given start and end positions, inclusive,
using
the given step between iterations and the given accuracy to check whether the end value has occurred.java.lang.IllegalArgumentException
- if step < 0
steppingFrom(double, double)
static DoubleSequence recurse(double seed, java.util.function.DoubleUnaryOperator op)
static DoubleSequence generate(java.util.function.DoubleSupplier supplier)
DoubleSequence
that is generated from the given supplier and thus never terminates.recurse(double, DoubleUnaryOperator)
,
endingAt(double, double)
,
until(double, double)
static DoubleSequence multiGenerate(java.util.function.Supplier<? extends java.util.function.DoubleSupplier> supplierSupplier)
DoubleSequence
where each DoubleIterable.iterator()
is generated by polling for a supplier and then
using it to generate the sequence of doubles
. The sequence never terminates.recurse(double, DoubleUnaryOperator)
,
endingAt(double, double)
,
until(double, double)
static DoubleSequence random()
DoubleSequence
of random doubles between 0
, inclusive and 1
, exclusive, that
never terminates. Each run of this DoubleSequence
's DoubleIterable.iterator()
will produce a new random
sequence of doubles. This method is equivalent to random (Random::new)
.random(Supplier)
,
Random.nextDouble()
static DoubleSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier)
DoubleSequence
of random doubles between 0
, inclusive and 1
, exclusive, that
never terminates. The given supplier is used to produce the instance of Random
that is used, one for
each new DoubleIterable.iterator()
.random()
,
Random.nextDouble()
static DoubleSequence random(double upper)
DoubleSequence
of random doubles between 0
, inclusive, and the upper bound, exclusive,
that never terminates. Each run of this DoubleSequence
's DoubleIterable.iterator()
will produce a new random
sequence of doubles. This method is equivalent to random(Random::new, upper
.random(Supplier, double)
,
Random.nextDouble()
static DoubleSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, double upper)
DoubleSequence
of random doubles 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 DoubleIterable.iterator()
.random(double)
,
Random.nextDouble()
static DoubleSequence random(double lower, double upper)
DoubleSequence
of random doubles between the lower bound, inclusive, and upper bound,
exclusive, that never terminates. Each run of this DoubleSequence
's DoubleIterable.iterator()
will produce a
new random sequence of doubles. This method is equivalent to random(Random::new, lower, upper
.random(Supplier, double, double)
,
Random.nextDouble()
static DoubleSequence random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, double lower, double upper)
DoubleSequence
of random doubles 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 DoubleIterable.iterator()
.random(double, double)
,
Random.nextDouble()
default DoubleSequence until(double terminal, double accuracy)
DoubleSequence
before the given element compared to the given accuracy, with the previous
element as the last element in this DoubleSequence
.default DoubleSequence endingAt(double terminal, double accuracy)
DoubleSequence
at the given element compared to the given accuracy, including it as the
last element in this DoubleSequence
.default DoubleSequence until(java.util.function.DoublePredicate terminal)
DoubleSequence
before the element that satisfies the given predicate, with the
previous element as the last element in this DoubleSequence
.default DoubleSequence endingAt(java.util.function.DoublePredicate terminal)
DoubleSequence
at the element that satisfies the given predicate, including the
element as the last element in this DoubleSequence
.default DoubleSequence startingAfter(double element, double accuracy)
DoubleSequence
just after the given element is encountered, not including the element in the
DoubleSequence
.startingAfter(DoublePredicate)
,
startingFrom(double, double)
default DoubleSequence startingFrom(double element, double accuracy)
DoubleSequence
when the given element is encountered, including the element as the first
element
in the DoubleSequence
.startingFrom(DoublePredicate)
,
startingAfter(double, double)
default DoubleSequence startingAfter(java.util.function.DoublePredicate predicate)
DoubleSequence
just after the given predicate is satisfied, not including the element that
satisfies the predicate in the DoubleSequence
.startingAfter(double, double)
,
startingFrom(DoublePredicate)
default DoubleSequence startingFrom(java.util.function.DoublePredicate predicate)
DoubleSequence
when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the DoubleSequence
.startingFrom(double, double)
,
startingAfter(DoublePredicate)
default DoubleSequence map(java.util.function.DoubleUnaryOperator mapper)
doubles
in this DoubleSequence
to another set of doubles
specified by the given
mapper
function.default DoubleSequence mapIndexed(DoubleLongToDoubleFunction mapper)
doubles
in this DoubleSequence
to another set of doubles
specified by the given
mapper
function, while providing the current index to the mapper.default Sequence<java.lang.Double> box()
doubles
in this DoubleSequence
to their boxed Double
counterparts.default <T> Sequence<T> toSequence(java.util.function.DoubleFunction<T> mapper)
default DoubleSequence skip(long skip)
doubles
in this DoubleSequence
.default DoubleSequence skipTail(int skip)
doubles
at the end of this DoubleSequence
.default DoubleSequence limit(long limit)
doubles
returned by this DoubleSequence
.default DoubleSequence append(double... doubles)
doubles
to the end of this DoubleSequence
.default DoubleSequence append(DoubleIterable that)
default DoubleSequence append(java.lang.Iterable<java.lang.Double> iterable)
Double
s in the given Iterable
to the end of this DoubleSequence
.default DoubleSequence append(java.util.PrimitiveIterator.OfDouble iterator)
doubles
in the given PrimitiveIterator.OfDouble
to the end of this
DoubleSequence
.
The appended doubles
will only be available on the first traversal of the resulting DoubleSequence
.
default DoubleSequence append(java.util.Iterator<java.lang.Double> iterator)
Double
s in the given Iterator
to the end of this DoubleSequence
.
The appended Double
s will only be available on the first traversal of the resulting
DoubleSequence
.
default DoubleSequence append(java.util.stream.DoubleStream stream)
double
values of the given DoubleStream
to the end of this DoubleSequence
.
The appended Double
s will only be available on the first traversal of the resulting
DoubleSequence
.
default DoubleSequence append(java.util.stream.Stream<java.lang.Double> stream)
Double
s in the given Stream
to the end of this DoubleSequence
.
The appended Double
s will only be available on the first traversal of the resulting
DoubleSequence
.
default DoubleSequence filter(java.util.function.DoublePredicate predicate)
DoubleSequence
, keeping only the elements that match the given
DoublePredicate
.default DoubleSequence filterIndexed(DoubleLongPredicate predicate)
DoubleSequence
, keeping only the elements that match the given
DoubleLongPredicate
, which is passed each double
together with its index in the sequence.default DoubleSequence filterBack(double firstPrevious, DoubleBiPredicate predicate)
DoubleSequence
to another sequence of doubles while peeking at the previous value in the
sequence.
The predicate has access to the previous double and the current double in the iteration. If the current double 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 DoubleSequence filterForward(double lastNext, DoubleBiPredicate predicate)
DoubleSequence
to another sequence of doubles while peeking at the next double in the
sequence.
The predicate has access to the current double and the next double in the iteration. If the current double 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 DoubleSequence including(double precision, double... elements)
DoubleSequence
containing only the doubles
found in the given target array.default DoubleSequence excluding(double precision, double... elements)
DoubleSequence
containing only the doubles
not found in the given target array.default <C> C collect(java.util.function.Supplier<? extends C> constructor, java.util.function.ObjDoubleConsumer<? super C> adder)
DoubleSequence
into an arbitrary container using the given constructor and adder.default <C> C collectInto(C result, java.util.function.ObjDoubleConsumer<? super C> adder)
DoubleSequence
into the given container using the given adder.default java.lang.String join(java.lang.String delimiter)
DoubleSequence
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)
DoubleSequence
into a string separated by the given delimiter, with the given prefix and
suffix.default java.util.OptionalDouble reduce(java.util.function.DoubleBinaryOperator operator)
DoubleSequence
into a single double
by iteratively applying the given binary
operator to the current result and each double
in the sequence.default double reduce(double identity, java.util.function.DoubleBinaryOperator operator)
DoubleSequence
into a single double
by iteratively applying the given binary
operator to the current result and each double
in the sequence, starting with the given identity as the
initial result.default java.util.OptionalDouble first()
DoubleSequence
or an empty OptionalDouble
if there are no
doubles in the DoubleSequence
.default java.util.OptionalDouble second()
DoubleSequence
or an empty OptionalDouble
if there are less
than two doubles in the DoubleSequence
.default java.util.OptionalDouble third()
DoubleSequence
or an empty OptionalDouble
if there are less
than three doubles in the DoubleSequence
.default java.util.OptionalDouble last()
DoubleSequence
or an empty OptionalDouble
if there are no
doubles in the DoubleSequence
.default java.util.OptionalDouble at(long index)
double
at the given index, or an empty OptionalDouble
if the DoubleSequence
is smaller than the index.default java.util.OptionalDouble first(java.util.function.DoublePredicate predicate)
DoubleSequence
matching the given predicate, or an empty
OptionalDouble
if there are no matching doubles in the DoubleSequence
.filter(DoublePredicate)
,
at(long, DoublePredicate)
default java.util.OptionalDouble second(java.util.function.DoublePredicate predicate)
DoubleSequence
matching the given predicate, or an empty
OptionalDouble
if there are less than two matching doubles in the DoubleSequence
.filter(DoublePredicate)
,
at(long, DoublePredicate)
default java.util.OptionalDouble third(java.util.function.DoublePredicate predicate)
DoubleSequence
matching the given predicate, or an empty
OptionalDouble
if there are less than three matching doubles in the DoubleSequence
.filter(DoublePredicate)
,
at(long, DoublePredicate)
default java.util.OptionalDouble last(java.util.function.DoublePredicate predicate)
DoubleSequence
matching the given predicate, or an empty
OptionalDouble
if there are no matching doubles in the DoubleSequence
.filter(DoublePredicate)
,
at(long, DoublePredicate)
default java.util.OptionalDouble at(long index, java.util.function.DoublePredicate predicate)
double
at the given index out of doubles matching the given predicate, or an empty
OptionalDouble
if the matching DoubleSequence
is smaller than the index.filter(DoublePredicate)
default DoubleSequence step(long step)
DoubleSequence
.default java.util.OptionalDouble min()
DoubleSequence
.default java.util.OptionalDouble max()
DoubleSequence
.default long size()
DoubleSequence
.@Deprecated default long count()
size()
instead.DoubleSequence
.default boolean all(java.util.function.DoublePredicate predicate)
DoubleSequence
satisfy the given predicate, false otherwise.default boolean none(java.util.function.DoublePredicate predicate)
DoubleSequence
satisfy the given predicate, false otherwise.default boolean any(java.util.function.DoublePredicate predicate)
DoubleSequence
satisfy the given predicate, false otherwise.default DoubleSequence peek(java.util.function.DoubleConsumer action)
DoubleConsumer
to see each element in this DoubleSequence
as it is traversed.default DoubleSequence peekIndexed(DoubleLongConsumer action)
DoubleLongConsumer
to see each element together with its index in this
DoubleSequence
as it is traversed.default DoubleSequence sorted()
DoubleSequence
sorted according to the natural order of the double values.reverse()
default double[] toArray()
DoubleSequence
into an array.default DoubleSequence prefix(double... xs)
DoubleSequence
with the given doubles.default DoubleSequence suffix(double... xs)
DoubleSequence
with the given doubles.default DoubleSequence interleave(DoubleIterable that)
DoubleSequence
with those of the given DoubleIterable
, stopping
when either sequence finishes.default DoubleSequence reverse()
DoubleSequence
which iterates over this DoubleSequence
in reverse order.sorted()
default DoubleSequence mapBack(double firstPrevious, java.util.function.DoubleBinaryOperator mapper)
DoubleSequence
to another sequence of doubles while peeking at the previous value in the
sequence.
The mapper has access to the previous double and the current double in the iteration. If the current double 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 DoubleSequence mapForward(double lastNext, java.util.function.DoubleBinaryOperator mapper)
DoubleSequence
to another sequence of doubles while peeking at the next value in the
sequence.
The mapper has access to the current double and the next double in the iteration. If the current double 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 toInts()
default LongSequence toLongs()
default IntSequence toRoundedInts()
default IntSequence toInts(java.util.function.DoubleToIntFunction mapper)
default LongSequence toRoundedLongs()
default LongSequence toLongs(java.util.function.DoubleToLongFunction mapper)
default DoubleSequence repeat()
The resulting sequence will never terminate if this sequence is non-empty.
default DoubleSequence repeat(long times)
default Sequence<DoubleSequence> window(int window)
DoubleSequence
into a sequence of DoubleSequence
s 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
DoubleSequence
may be shorter than the window. This is equivalent to window(window, 1)
.default Sequence<DoubleSequence> window(int window, int step)
DoubleSequence
into a sequence of DoubleSequence
s 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<DoubleSequence> batch(int size)
DoubleSequence
into a sequence of DoubleSequence
s of distinct
elements,
each with the given batch size. This is equivalent to window(size, size)
.default Sequence<DoubleSequence> batch(DoubleBiPredicate predicate)
DoubleSequence
into a sequence of DoubleSequence
s 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<DoubleSequence> split(double element)
doubles
of this DoubleSequence
into a sequence of DoubleSequence
s of distinct
elements, around the given double
. The elements around which the sequence is split are not included in
the result.default Sequence<DoubleSequence> split(java.util.function.DoublePredicate predicate)
doubles
of this DoubleSequence
into a sequence of DoubleSequence
s of distinct
elements, where the given predicate determines which doubles
to split the partitioned elements around.
The
doubles
matching the predicate are not included in the result.default void clear()
Iterator.remove()
.@Deprecated default void removeAll()
clear()
instead.Iterator.remove()
.default boolean isEmpty()
DoubleSequence
is empty, false otherwise.default boolean contains(double d, double precision)
DoubleSequence
contains the given double
, false otherwise.default boolean containsAll(double precision, double... items)
DoubleSequence
contains all of the given doubles
compared to the given
precision, false otherwise.default boolean containsAny(double precision, double... items)
DoubleSequence
contains any of the given doubles
, false otherwise.default void forEachDoubleIndexed(DoubleLongConsumer action)
double
in this DoubleSequence
, with the index of each element passed
as the second parameter in the action.