@FunctionalInterface public interface DoubleSequence extends DoubleCollection
Iterable
sequence of double
values with Stream
-like operations for refining,
transforming and collating the list of doubles.DoubleCollection.Base
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 DoubleList |
asList() |
default java.util.OptionalDouble |
at(int index) |
default java.util.OptionalDouble |
at(int 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 <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 <U extends DoubleCollection> |
collectInto(U collection)
Collect this
DoubleSequence into the given DoubleCollection . |
default DoubleSequence |
distinct(double precision) |
default DoubleSequence |
distinctExactly() |
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[] elements,
double precision) |
default DoubleSequence |
excludingExactly(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(DoubleIntPredicate predicate)
Filter the elements in this
DoubleSequence , keeping only the elements that match the given
DoubleIntPredicate , 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(DoubleIntConsumer 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.lang.Iterable<java.lang.Double> iterable)
Create a
DoubleSequence from an Iterable of Double values. |
static DoubleSequence |
generate(java.util.function.DoubleSupplier supplier) |
default DoubleSequence |
including(double[] elements,
double precision) |
default DoubleSequence |
includingExactly(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(int 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(DoubleIntToDoubleFunction 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(DoubleIntConsumer action)
Allow the given
DoubleIntConsumer 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 DoubleSequence |
repeat()
Repeat this sequence of characters doubles, looping back to the beginning when the iterator runs out of doubles.
|
default DoubleSequence |
repeat(int times)
Repeat this sequence of doubles x times, looping back to the beginning when the iterator runs out of doubles.
|
default DoubleSequence |
reverse() |
default int |
size() |
default DoubleSequence |
skip(int 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 java.util.Spliterator.OfDouble |
spliterator() |
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(int 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 <U extends DoubleCollection> |
toCollection(java.util.function.Supplier<? extends U> constructor)
Collect this
DoubleSequence into an DoubleCollection of the type determined by the given
constructor. |
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 DoubleList |
toList()
Collect the elements in this
DoubleSequence into an DoubleList . |
default DoubleList |
toList(java.util.function.Supplier<? extends DoubleList> constructor)
Collect the elements in this
DoubleSequence into an DoubleList of the type determined by the
given constructor. |
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 DoubleSet |
toSet()
Collect the elements in this
DoubleSequence into an DoubleSet . |
default <S extends DoubleSet> |
toSet(java.util.function.Supplier<? extends S> constructor)
Collect the elements in this
DoubleSequence into an DoubleSet of the type determined by the
given constructor. |
default DoubleSortedSet |
toSortedSet()
Collect the elements in this
DoubleSequence into an DoubleSortedSet . |
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. |
add, addAll, addAllDoubles, addAllDoubles, addDouble, addDouble, addDoubleExactly, clear, contains, containsAll, remove, removeAll, removeIf, retainAll, toArray, toArray, toDoubleArray
equals, hashCode, iterator, parallelStream, stream
containsAllDoubles, containsAllDoubles, containsAllDoublesExactly, containsAllDoublesExactly, containsAnyDoubles, containsAnyDoubles, containsAnyDoublesExactly, containsAnyDoublesExactly, containsDouble, containsDoubleExactly, doubleStream, forEach, forEachDouble, from, iterator, once, parallelDoubleStream, removeAllDoubles, removeAllDoubles, removeAllDoublesExactly, removeAllDoublesExactly, removeDouble, removeDoubleExactly, removeDoublesIf, retainAllDoubles, retainAllDoubles, retainAllDoublesExactly, retainAllDoublesExactly, sequence
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)
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 Collection.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 Collection.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 Collection.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 Collection.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 Collection.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 Collection.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 Collection.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(DoubleIntToDoubleFunction 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(int skip)
doubles
in this DoubleSequence
.default DoubleSequence skipTail(int skip)
doubles
at the end of this DoubleSequence
.default DoubleSequence limit(int 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(DoubleIntPredicate predicate)
DoubleSequence
, keeping only the elements that match the given
DoubleIntPredicate
, 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 includingExactly(double... elements)
DoubleSequence
containing only the doubles
found in the given target array,
compared to the given precision.default DoubleSequence including(double[] elements, double precision)
DoubleSequence
containing only the doubles
found in the given target array,
compared with the given precision.default DoubleSequence excludingExactly(double... elements)
DoubleSequence
containing only the doubles
not found in the given target array,
compared to the given precision.default DoubleSequence excluding(double[] elements, double precision)
DoubleSequence
containing only the doubles
not found in the given target array,
compared with the given precision.default DoubleList toList()
DoubleSequence
into an DoubleList
.default DoubleList toList(java.util.function.Supplier<? extends DoubleList> constructor)
DoubleSequence
into an DoubleList
of the type determined by the
given constructor.default <S extends DoubleSet> S toSet(java.util.function.Supplier<? extends S> constructor)
DoubleSequence
into an DoubleSet
of the type determined by the
given constructor.default DoubleSortedSet toSortedSet()
DoubleSequence
into an DoubleSortedSet
.default <U extends DoubleCollection> U toCollection(java.util.function.Supplier<? extends U> constructor)
DoubleSequence
into an DoubleCollection
of the type determined by the given
constructor.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 <U extends DoubleCollection> U collectInto(U collection)
DoubleSequence
into the given DoubleCollection
.default <C> C collectInto(C result, java.util.function.ObjDoubleConsumer<? super C> adder)
DoubleSequence
into the given container using the given adder.default DoubleList asList()
DoubleList
view of this DoubleSequence
, which is updated in real time as the backing
store of the DoubleSequence
changes. The list does not implement RandomAccess
and is best
accessed in sequence.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 last()
DoubleSequence
or an empty OptionalDouble
if there are no
doubles in the DoubleSequence
.default java.util.OptionalDouble at(int 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(int, 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(int, DoublePredicate)
default java.util.OptionalDouble at(int 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(int step)
DoubleSequence
.default DoubleSequence distinct(double precision)
DoubleSequence
where each item occurs only once, the first time it is encountered,
compared to the given precision.default DoubleSequence distinctExactly()
DoubleSequence
where each item occurs only once, the first time it is encountered.default java.util.OptionalDouble min()
DoubleSequence
.default java.util.OptionalDouble max()
DoubleSequence
.default int size()
size
in interface java.util.Collection<java.lang.Double>
DoubleSequence
.default java.util.Spliterator.OfDouble spliterator()
spliterator
in interface java.util.Collection<java.lang.Double>
spliterator
in interface DoubleCollection
spliterator
in interface DoubleIterable
spliterator
in interface java.lang.Iterable<java.lang.Double>
Spliterator.OfDouble
for this 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(DoubleIntConsumer action)
DoubleIntConsumer
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 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(int 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 boolean isEmpty()
isEmpty
in interface java.util.Collection<java.lang.Double>
isEmpty
in interface DoubleCollection
isEmpty
in interface DoubleIterable
DoubleSequence
is empty, false otherwise.default void forEachDoubleIndexed(DoubleIntConsumer action)
double
in this DoubleSequence
, with the index of each element
passed as the second parameter in the action.