DoubleStreamDecorator wraps a Java DoubleStream and registers a closeHandler
which is passed further to any resulting Stream.
The goal of the DoubleStreamDecorator is to close the underlying DoubleStream upon
calling a terminal operation.
| Modifier and Type | Field and Description |
|---|---|
| private final Runnable | |
| private final DoubleStream |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | allMatch(DoublePredicate
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public boolean | anyMatch(DoublePredicate
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public OptionalDouble | average()
Implements java. OptionalDouble describing the arithmetic
mean of elements of this stream, or an empty optional if this
stream is empty.
|
| public Stream | boxed()
Implements java. Stream consisting of the elements of this stream,
boxed to Double.
|
| public void | close()
Implements java. |
| public <R> R | collect(Supplier<R>
a function that creates a new mutable result container.
For a parallel execution, this function may be called
multiple times and must return a fresh value each time. supplier, ObjDoubleConsumer<R> an associative,
non-interfering,
stateless
function that must fold an element into a result
container. accumulator, BiConsumer<R, R> an associative,
non-interfering,
stateless
function that accepts two partial result containers
and merges them, which must be compatible with the
accumulator function. The combiner function must fold
the elements from the second result container into the
first result container. combiner)Implements java. |
| public long | count()
Implements java. |
| public DoubleStream | distinct()
Implements java. |
| public DoubleStream | filter(DoublePredicate
a non-interfering,
stateless
predicate to apply to each element to determine if it
should be included predicate)Implements java. |
| public OptionalDouble | findAny()
Implements java. OptionalDouble describing some element of the stream,
or an empty OptionalDouble if the stream is empty.
|
| public OptionalDouble | findFirst()
Implements java. OptionalDouble describing the first element of this
stream, or an empty OptionalDouble if the stream is empty.
|
| public DoubleStream | flatMap(DoubleFunction<? extends DoubleStream>
a non-interfering,
stateless
function to apply to each element which produces a
mapper)DoubleStream of new valuesImplements java. |
| public void | forEach(DoubleConsumer
a
non-interfering action to perform on the elements action)Implements java. |
| public void | forEachOrdered(DoubleConsumer
a
non-interfering action to perform on the elements action)Implements java. |
| public boolean | isParallel()
Implements java. |
| public PrimitiveIterator. | iterator()
Implements java. |
| public DoubleStream | limit(long
the number of elements the stream should be limited to maxSize)Implements java. maxSize in length.
|
| public DoubleStream | map(DoubleUnaryOperator
a non-interfering,
stateless
function to apply to each element mapper)Implements java. |
| public IntStream | mapToInt(DoubleToIntFunction
a non-interfering,
stateless
function to apply to each element mapper)Implements java. IntStream consisting of the results of applying the
given function to the elements of this stream.
|
| public LongStream | mapToLong(DoubleToLongFunction
a non-interfering,
stateless
function to apply to each element mapper)Implements java. LongStream consisting of the results of applying the
given function to the elements of this stream.
|
| public <U> Stream | mapToObj(DoubleFunction<? extends U>
a non-interfering,
stateless
function to apply to each element mapper)Implements java. Stream consisting of the results of
applying the given function to the elements of this stream.
|
| public OptionalDouble | max()
Implements java. OptionalDouble describing the maximum element of this
stream, or an empty OptionalDouble if this stream is empty.
|
| public OptionalDouble | min()
Implements java. OptionalDouble describing the minimum element of this
stream, or an empty OptionalDouble if this stream is empty.
|
| public boolean | noneMatch(DoublePredicate
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public DoubleStream | onClose(Runnable
A task to execute when the stream is closed closeHandler)Implements java. |
| public DoubleStream | parallel()
Implements java. |
| public DoubleStream | peek(DoubleConsumer
a
non-interfering action to perform on the elements as
they are consumed from the stream action)Implements java. |
| public double | reduce(double
the identity value for the accumulating function identity, DoubleBinaryOperator op)Implements java. |
| public OptionalDouble | reduce(DoubleBinaryOperator op)
Implements java. OptionalDouble describing the reduced
value, if any.
|
| public DoubleStream | sequential()
Implements java. |
| public DoubleStream | skip(long
the number of leading elements to skip n)Implements java. n elements of the stream.
|
| public DoubleStream | sorted()
Implements java. |
| public Spliterator. | spliterator()
Implements java. |
| public double | |
| public DoubleSummaryStatistics | summaryStatistics()
Implements java. DoubleSummaryStatistics describing various summary data
about the elements of this stream.
|
| public double[] | toArray()
Implements java. |
| public DoubleStream | unordered()
Implements java. |
| closeHandler | back to summary |
|---|---|
| private final Runnable closeHandler | |
| delegate | back to summary |
|---|---|
| private final DoubleStream delegate | |
| DoubleStreamDecorator | back to summary |
|---|---|
| public DoubleStreamDecorator(DoubleStream delegate, Runnable closeHandler) | |
| allMatch | back to summary |
|---|---|
| public boolean allMatch(DoublePredicate predicate) Implements java. Doc from java. Returns whether all elements of this stream match the provided predicate.
May not evaluate the predicate on all elements if not necessary for
determining the result. If the stream is empty then This is a short-circuiting terminal operation.
| |
| anyMatch | back to summary |
|---|---|
| public boolean anyMatch(DoublePredicate predicate) Implements java. Doc from java. Returns whether any elements of this stream match the provided
predicate. May not evaluate the predicate on all elements if not
necessary for determining the result. If the stream is empty then
This is a short-circuiting terminal operation.
| |
| average | back to summary |
|---|---|
| public OptionalDouble average() Implements java. Doc from java. Returns an The computed average can vary numerically and have the
special case behavior as computing the sum; see The average is a special case of a reduction. This is a terminal operation.
| |
| boxed | back to summary |
|---|---|
| public Stream Implements java. Doc from java. Returns a This is an intermediate operation. | |
| close | back to summary |
|---|---|
| public void close() Implements java. Doc from java. Closes this stream, causing all close handlers for this stream pipeline to be called.
| |
| collect | back to summary |
|---|---|
| public <R> R collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R, R> combiner) Implements java. Doc from java. Performs a mutable
reduction operation on the elements of this stream. A mutable
reduction is one in which the reduced value is a mutable result container,
such as an
Like This is a terminal operation.
| |
| count | back to summary |
|---|---|
| public long count() Implements java. Doc from java. Returns the count of elements in this stream. This is a special case of a reduction and is equivalent to:
This is a terminal operation.
| |
| distinct | back to summary |
|---|---|
| public DoubleStream distinct() Implements java. Doc from java. Returns a stream consisting of the distinct elements of this stream. The
elements are compared for equality according to
This is a stateful intermediate operation.
| |
| filter | back to summary |
|---|---|
| public DoubleStream filter(DoublePredicate predicate) Implements java. Doc from java. Returns a stream consisting of the elements of this stream that match the given predicate. This is an intermediate operation.
| |
| findAny | back to summary |
|---|---|
| public OptionalDouble findAny() Implements java. Doc from java. Returns an This is a short-circuiting terminal operation. The behavior of this operation is explicitly nondeterministic; it is
free to select any element in the stream. This is to allow for maximal
performance in parallel operations; the cost is that multiple invocations
on the same source may not return the same result. (If a stable result
is desired, use
| |
| findFirst | back to summary |
|---|---|
| public OptionalDouble findFirst() Implements java. Doc from java. Returns an This is a short-circuiting terminal operation.
| |
| flatMap | back to summary |
|---|---|
| public DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper) Implements java. Doc from java. Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element. Each mapped stream is
This is an intermediate operation.
| |
| forEach | back to summary |
|---|---|
| public void forEach(DoubleConsumer action) Implements java. Doc from java. Performs an action for each element of this stream. This is a terminal operation. For parallel stream pipelines, this operation does not guarantee to respect the encounter order of the stream, as doing so would sacrifice the benefit of parallelism. For any given element, the action may be performed at whatever time and in whatever thread the library chooses. If the action accesses shared state, it is responsible for providing the required synchronization.
| |
| forEachOrdered | back to summary |
|---|---|
| public void forEachOrdered(DoubleConsumer action) Implements java. Doc from java. Performs an action for each element of this stream, guaranteeing that each element is processed in encounter order for streams that have a defined encounter order. This is a terminal operation.
| |
| isParallel | back to summary |
|---|---|
| public boolean isParallel() Implements java. Doc from java. Returns whether this stream, if a terminal operation were to be executed, would execute in parallel. Calling this method after invoking an terminal stream operation method may yield unpredictable results.
| |
| iterator | back to summary |
|---|---|
| public PrimitiveIterator. Implements java. Doc from java. Returns an iterator for the elements of this stream. This is a terminal operation.
| |
| limit | back to summary |
|---|---|
| public DoubleStream limit(long maxSize) Implements java. Doc from java. Returns a stream consisting of the elements of this stream, truncated
to be no longer than This is a short-circuiting stateful intermediate operation.
| |
| map | back to summary |
|---|---|
| public DoubleStream map(DoubleUnaryOperator mapper) Implements java. Doc from java. Returns a stream consisting of the results of applying the given function to the elements of this stream. This is an intermediate operation.
| |
| mapToInt | back to summary |
|---|---|
| public IntStream mapToInt(DoubleToIntFunction mapper) Implements java. Doc from java. Returns an This is an intermediate operation.
| |
| mapToLong | back to summary |
|---|---|
| public LongStream mapToLong(DoubleToLongFunction mapper) Implements java. Doc from java. Returns a This is an intermediate operation.
| |
| mapToObj | back to summary |
|---|---|
| public <U> Stream Implements java. Doc from java. Returns an object-valued This is an intermediate operation.
| |
| max | back to summary |
|---|---|
| public OptionalDouble max() Implements java. Doc from java. Returns an
This is a terminal operation.
| |
| min | back to summary |
|---|---|
| public OptionalDouble min() Implements java. Doc from java. Returns an
This is a terminal operation.
| |
| noneMatch | back to summary |
|---|---|
| public boolean noneMatch(DoublePredicate predicate) Implements java. Doc from java. Returns whether no elements of this stream match the provided predicate.
May not evaluate the predicate on all elements if not necessary for
determining the result. If the stream is empty then This is a short-circuiting terminal operation.
| |
| onClose | back to summary |
|---|---|
| public DoubleStream onClose(Runnable closeHandler) Implements java. Doc from java. Returns an equivalent stream with an additional close handler. Close
handlers are run when the This is an intermediate operation.
| |
| parallel | back to summary |
|---|---|
| public DoubleStream parallel() Implements java. Doc from java. Returns an equivalent stream that is parallel. May return itself, either because the stream was already parallel, or because the underlying stream state was modified to be parallel. This is an intermediate operation.
| |
| peek | back to summary |
|---|---|
| public DoubleStream peek(DoubleConsumer action) Implements java. Doc from java. Returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream. This is an intermediate operation. For parallel stream pipelines, the action may be called at whatever time and in whatever thread the element is made available by the upstream operation. If the action modifies shared state, it is responsible for providing the required synchronization.
| |
| reduce | back to summary |
|---|---|
| public double reduce(double identity, DoubleBinaryOperator op) Implements java. Doc from java. Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value. This is equivalent to:
but is not constrained to execute sequentially.
The This is a terminal operation.
| |
| reduce | back to summary |
|---|---|
| public OptionalDouble reduce(DoubleBinaryOperator op) Implements java. Doc from java. Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
but is not constrained to execute sequentially.
The This is a terminal operation.
| |
| sequential | back to summary |
|---|---|
| public DoubleStream sequential() Implements java. Doc from java. Returns an equivalent stream that is sequential. May return itself, either because the stream was already sequential, or because the underlying stream state was modified to be sequential. This is an intermediate operation.
| |
| skip | back to summary |
|---|---|
| public DoubleStream skip(long n) Implements java. Doc from java. Returns a stream consisting of the remaining elements of this stream
after discarding the first This is a stateful intermediate operation.
| |
| sorted | back to summary |
|---|---|
| public DoubleStream sorted() Implements java. Doc from java. Returns a stream consisting of the elements of this stream in sorted
order. The elements are compared for equality according to
This is a stateful intermediate operation.
| |
| spliterator | back to summary |
|---|---|
| public Spliterator. Implements java. Doc from java. Returns a spliterator for the elements of this stream. This is a terminal operation.
| |
| sum | back to summary |
|---|---|
| public double sum() Implements java. Doc from java. Returns the sum of elements in this stream. Summation is a special case of a reduction. If floating-point summation were exact, this method would be equivalent to:
However, since floating-point summation is not exact, the above
code is not necessarily equivalent to the summation computation
done by this method.
The value of a floating-point sum is a function both
of the input values as well as the order of addition
operations. The order of addition operations of this method is
intentionally not defined to allow for implementation
flexibility to improve the speed and accuracy of the computed
result.
In particular, this method may be implemented using compensated
summation or other technique to reduce the error bound in the
numerical sum compared to a simple summation of Various conditions can result in a non-finite sum being computed. This can occur even if the all the elements being summed are finite. If any element is non-finite, the sum will be non-finite:
This is a terminal operation.
| |
| summaryStatistics | back to summary |
|---|---|
| public DoubleSummaryStatistics summaryStatistics() Implements java. Doc from java. Returns a This is a terminal operation.
| |
| toArray | back to summary |
|---|---|
| public double[] toArray() Implements java. Doc from java. Returns an array containing the elements of this stream. This is a terminal operation.
| |
| unordered | back to summary |
|---|---|
| public DoubleStream unordered() Implements java. Doc from java. Returns an equivalent stream that is unordered. May return itself, either because the stream was already unordered, or because the underlying stream state was modified to be unordered. This is an intermediate operation.
| |