public interface DistributedDoubleStream extends java.util.stream.DoubleStream
DoubleStream to support distributed stream operations by replacing
functional interfaces with their serializable equivalents.java.util.stream.DoubleStream.Builder| Modifier and Type | Method and Description |
|---|---|
default boolean |
allMatch(Distributed.DoublePredicate predicate)
Returns whether all elements of this stream match the provided predicate.
|
boolean |
allMatch(java.util.function.DoublePredicate predicate) |
default boolean |
anyMatch(Distributed.DoublePredicate predicate)
Returns whether any elements of this stream match the provided
predicate.
|
boolean |
anyMatch(java.util.function.DoublePredicate predicate) |
DistributedStream<Double> |
boxed()
Returns a
DistributedStream consisting of the elements of this stream,
boxed to Double. |
default <R> R |
collect(Distributed.Supplier<R> supplier,
Distributed.ObjDoubleConsumer<R> accumulator,
Distributed.BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
<R> R |
collect(java.util.function.Supplier<R> supplier,
java.util.function.ObjDoubleConsumer<R> accumulator,
java.util.function.BiConsumer<R,R> combiner) |
DistributedDoubleStream |
distinct()
Returns a stream consisting of the distinct elements of this stream.
|
default DistributedDoubleStream |
filter(Distributed.DoublePredicate predicate)
Returns a stream consisting of the elements of this stream that match
the given predicate.
|
DistributedDoubleStream |
filter(java.util.function.DoublePredicate predicate) |
default DistributedDoubleStream |
flatMap(Distributed.DoubleFunction<? extends java.util.stream.DoubleStream> mapper)
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.
|
DistributedDoubleStream |
flatMap(java.util.function.DoubleFunction<? extends java.util.stream.DoubleStream> mapper) |
default void |
forEach(Distributed.DoubleConsumer action)
Performs an action for each element of this stream.
|
void |
forEach(java.util.function.DoubleConsumer action) |
default void |
forEachOrdered(Distributed.DoubleConsumer action)
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.
|
void |
forEachOrdered(java.util.function.DoubleConsumer action) |
DistributedDoubleStream |
limit(long maxSize)
Returns a stream consisting of the elements of this stream, truncated
to be no longer than
maxSize in length. |
default DistributedDoubleStream |
map(Distributed.DoubleUnaryOperator mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
DistributedDoubleStream |
map(java.util.function.DoubleUnaryOperator mapper) |
default DistributedIntStream |
mapToInt(Distributed.DoubleToIntFunction mapper)
Returns an
IntStream consisting of the results of applying the
given function to the elements of this stream. |
DistributedIntStream |
mapToInt(java.util.function.DoubleToIntFunction mapper) |
default DistributedLongStream |
mapToLong(Distributed.DoubleToLongFunction mapper)
Returns a
LongStream consisting of the results of applying the
given function to the elements of this stream. |
DistributedLongStream |
mapToLong(java.util.function.DoubleToLongFunction mapper) |
default <U> DistributedStream<U> |
mapToObj(Distributed.DoubleFunction<? extends U> mapper)
Returns an object-valued
Stream consisting of the results of
applying the given function to the elements of this stream. |
<U> DistributedStream<U> |
mapToObj(java.util.function.DoubleFunction<? extends U> mapper) |
default boolean |
noneMatch(Distributed.DoublePredicate predicate)
Returns whether no elements of this stream match the provided predicate.
|
boolean |
noneMatch(java.util.function.DoublePredicate predicate) |
DistributedDoubleStream |
parallel()
Returns an equivalent stream that is parallel.
|
default DistributedDoubleStream |
peek(Distributed.DoubleConsumer action)
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.
|
DistributedDoubleStream |
peek(java.util.function.DoubleConsumer action) |
default OptionalDouble |
reduce(Distributed.DoubleBinaryOperator op)
Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
OptionalDouble describing the reduced
value, if any. |
OptionalDouble |
reduce(java.util.function.DoubleBinaryOperator op) |
default double |
reduce(double identity,
Distributed.DoubleBinaryOperator op)
Performs a reduction on the
elements of this stream, using the provided identity value and an
associative
accumulation function, and returns the reduced value.
|
double |
reduce(double identity,
java.util.function.DoubleBinaryOperator op) |
DistributedDoubleStream |
sequential()
Returns an equivalent stream that is sequential.
|
DistributedDoubleStream |
skip(long n)
Returns a stream consisting of the remaining elements of this stream
after discarding the first
n elements of the stream. |
DistributedDoubleStream |
sorted()
Returns a stream consisting of the elements of this stream in sorted
order.
|
average, builder, concat, count, empty, findAny, findFirst, generate, iterate, iterator, max, min, of, of, spliterator, sum, summaryStatistics, toArrayclose, isParallel, onClose, unordereddefault DistributedDoubleStream filter(Distributed.DoublePredicate predicate)
This is an intermediate operation.
predicate - a non-interfering,
stateless
predicate to apply to each element to determine if it
should be includeddefault DistributedDoubleStream map(Distributed.DoubleUnaryOperator mapper)
This is an intermediate operation.
mapper - a non-interfering,
stateless
function to apply to each elementdefault <U> DistributedStream<U> mapToObj(Distributed.DoubleFunction<? extends U> mapper)
Stream consisting of the results of
applying the given function to the elements of this stream.
This is an intermediate operation.
U - the element type of the new streammapper - a non-interfering,
stateless
function to apply to each elementdefault DistributedLongStream mapToLong(Distributed.DoubleToLongFunction mapper)
LongStream consisting of the results of applying the
given function to the elements of this stream.
This is an intermediate operation.
mapper - a non-interfering,
stateless
function to apply to each elementdefault DistributedIntStream mapToInt(Distributed.DoubleToIntFunction mapper)
IntStream consisting of the results of applying the
given function to the elements of this stream.
This is an intermediate operation.
mapper - a non-interfering,
stateless
function to apply to each elementdefault DistributedDoubleStream flatMap(Distributed.DoubleFunction<? extends java.util.stream.DoubleStream> mapper)
closed after its contents
have been placed into this stream. (If a mapped stream is null
an empty stream is used, instead.)
This is an intermediate operation.
mapper - a non-interfering,
stateless
function to apply to each element which produces a
DoubleStream of new valuesDistributedStream.flatMap(Distributed.Function)DistributedDoubleStream distinct()
Double.compare(double, double).
This is a stateful intermediate operation.
distinct in interface java.util.stream.DoubleStreamDistributedDoubleStream sorted()
Double.compare(double, double).
This is a stateful intermediate operation.
sorted in interface java.util.stream.DoubleStreamdefault DistributedDoubleStream peek(Distributed.DoubleConsumer action)
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.
action - a
non-interfering action to perform on the elements as
they are consumed from the streamDistributedDoubleStream limit(long maxSize)
maxSize in length.
This is a short-circuiting stateful intermediate operation.
limit in interface java.util.stream.DoubleStreammaxSize - the number of elements the stream should be limited toIllegalArgumentException - if maxSize is negativeDistributedDoubleStream skip(long n)
n elements of the stream.
If this stream contains fewer than n elements then an
empty stream will be returned.
This is a stateful intermediate operation.
skip in interface java.util.stream.DoubleStreamn - the number of leading elements to skipIllegalArgumentException - if n is negativedefault void forEach(Distributed.DoubleConsumer action)
This is a terminal operation.
action - a
non-interfering action to perform on the elementsdefault void forEachOrdered(Distributed.DoubleConsumer action)
This is a terminal operation.
action - a
non-interfering action to perform on the elementsforEach(DoubleConsumer)default double reduce(double identity,
Distributed.DoubleBinaryOperator op)
double result = identity;
for (double element : this stream)
result = accumulator.applyAsDouble(result, element)
return result;
but is not constrained to execute sequentially.
The identity value must be an identity for the accumulator
function. This means that for all x,
accumulator.apply(identity, x) is equal to x.
The accumulator function must be an
associative function.
This is a terminal operation.
identity - the identity value for the accumulating functionop - an associative,
non-interfering,
stateless
function for combining two valuesDoubleStream.sum(),
DoubleStream.min(),
DoubleStream.max(),
DoubleStream.average()default OptionalDouble reduce(Distributed.DoubleBinaryOperator op)
OptionalDouble describing the reduced
value, if any. This is equivalent to:
boolean foundAny = false;
double result = null;
for (double element : this stream) {
if (!foundAny) {
foundAny = true;
result = element;
}
else
result = accumulator.applyAsDouble(result, element);
}
return foundAny ? OptionalDouble.of(result) : OptionalDouble.empty();
but is not constrained to execute sequentially.
The accumulator function must be an
associative function.
This is a terminal operation.
op - an associative,
non-interfering,
stateless
function for combining two valuesreduce(double, DoubleBinaryOperator)default <R> R collect(Distributed.Supplier<R> supplier, Distributed.ObjDoubleConsumer<R> accumulator, Distributed.BiConsumer<R,R> combiner)
ArrayList, and elements are incorporated by updating
the state of the result rather than by replacing the result. This
produces a result equivalent to:
R result = supplier.get();
for (double element : this stream)
accumulator.accept(result, element);
return result;
Like reduce(double, DoubleBinaryOperator), collect
operations can be parallelized without requiring additional
synchronization.
This is a terminal operation.
R - type of the resultsupplier - a function that creates a new result container. For a
parallel execution, this function may be called
multiple times and must return a fresh value each time.accumulator - an associative,
non-interfering,
stateless
function for incorporating an additional element into a resultcombiner - an associative,
non-interfering,
stateless
function for combining two values, which must be
compatible with the accumulator functionStream.collect(Supplier, BiConsumer, BiConsumer)default boolean anyMatch(Distributed.DoublePredicate predicate)
false is returned and the predicate is not evaluated.
This is a short-circuiting terminal operation.
predicate - a non-interfering,
stateless
predicate to apply to elements of this streamtrue if any elements of the stream match the provided
predicate, otherwise falsedefault boolean allMatch(Distributed.DoublePredicate predicate)
true is
returned and the predicate is not evaluated.
This is a short-circuiting terminal operation.
predicate - a non-interfering,
stateless
predicate to apply to elements of this streamtrue if either all elements of the stream match the
provided predicate or the stream is empty, otherwise falsedefault boolean noneMatch(Distributed.DoublePredicate predicate)
true is
returned and the predicate is not evaluated.
This is a short-circuiting terminal operation.
predicate - a non-interfering,
stateless
predicate to apply to elements of this streamtrue if either no elements of the stream match the
provided predicate or the stream is empty, otherwise falseDistributedStream<Double> boxed()
DistributedStream consisting of the elements of this stream,
boxed to Double.
This is an intermediate operation.
boxed in interface java.util.stream.DoubleStreamDistributedStream consistent of the elements of this stream,
each boxed to a DoubleDistributedDoubleStream sequential()
This is an intermediate operation.
sequential in interface java.util.stream.BaseStream<Double,java.util.stream.DoubleStream>sequential in interface java.util.stream.DoubleStreamDistributedDoubleStream parallel()
This is an intermediate operation.
parallel in interface java.util.stream.BaseStream<Double,java.util.stream.DoubleStream>parallel in interface java.util.stream.DoubleStreamDistributedDoubleStream filter(java.util.function.DoublePredicate predicate)
filter in interface java.util.stream.DoubleStreamDistributedDoubleStream map(java.util.function.DoubleUnaryOperator mapper)
map in interface java.util.stream.DoubleStream<U> DistributedStream<U> mapToObj(java.util.function.DoubleFunction<? extends U> mapper)
mapToObj in interface java.util.stream.DoubleStreamDistributedLongStream mapToLong(java.util.function.DoubleToLongFunction mapper)
mapToLong in interface java.util.stream.DoubleStreamDistributedIntStream mapToInt(java.util.function.DoubleToIntFunction mapper)
mapToInt in interface java.util.stream.DoubleStreamDistributedDoubleStream flatMap(java.util.function.DoubleFunction<? extends java.util.stream.DoubleStream> mapper)
flatMap in interface java.util.stream.DoubleStreamDistributedDoubleStream peek(java.util.function.DoubleConsumer action)
peek in interface java.util.stream.DoubleStreamvoid forEach(java.util.function.DoubleConsumer action)
forEach in interface java.util.stream.DoubleStreamvoid forEachOrdered(java.util.function.DoubleConsumer action)
forEachOrdered in interface java.util.stream.DoubleStreamdouble reduce(double identity,
java.util.function.DoubleBinaryOperator op)
reduce in interface java.util.stream.DoubleStreamOptionalDouble reduce(java.util.function.DoubleBinaryOperator op)
reduce in interface java.util.stream.DoubleStream<R> R collect(java.util.function.Supplier<R> supplier, java.util.function.ObjDoubleConsumer<R> accumulator, java.util.function.BiConsumer<R,R> combiner)
collect in interface java.util.stream.DoubleStreamboolean anyMatch(java.util.function.DoublePredicate predicate)
anyMatch in interface java.util.stream.DoubleStreamboolean allMatch(java.util.function.DoublePredicate predicate)
allMatch in interface java.util.stream.DoubleStreamboolean noneMatch(java.util.function.DoublePredicate predicate)
noneMatch in interface java.util.stream.DoubleStreamCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.