public interface DistributedLongStream extends java.util.stream.LongStream
LongStream
that supports distributed stream
operations by replacing functional interfaces with their serializable
equivalents.java.util.stream.LongStream.Builder
Modifier and Type | Method and Description |
---|---|
default boolean |
allMatch(DistributedLongPredicate predicate)
Returns whether all elements of this stream match the provided predicate.
|
boolean |
allMatch(java.util.function.LongPredicate predicate) |
default boolean |
anyMatch(DistributedLongPredicate predicate)
Returns whether any elements of this stream match the provided
predicate.
|
boolean |
anyMatch(java.util.function.LongPredicate predicate) |
DistributedDoubleStream |
asDoubleStream()
Returns a
DoubleStream consisting of the elements of this stream,
converted to double . |
DistributedStream<Long> |
boxed()
Returns a
Stream consisting of the elements of this stream,
each boxed to a Long . |
default <R> R |
collect(DistributedSupplier<R> supplier,
DistributedObjLongConsumer<R> accumulator,
DistributedBiConsumer<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.ObjLongConsumer<R> accumulator,
java.util.function.BiConsumer<R,R> combiner) |
DistributedLongStream |
configure(JobConfig jobConfig) |
DistributedLongStream |
distinct()
Returns a stream consisting of the distinct elements of this stream.
|
default DistributedLongStream |
filter(DistributedLongPredicate predicate)
Returns a stream consisting of the elements of this stream that match
the given predicate.
|
DistributedLongStream |
filter(java.util.function.LongPredicate predicate) |
default DistributedLongStream |
flatMap(DistributedLongFunction<? extends java.util.stream.LongStream> 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.
|
DistributedLongStream |
flatMap(java.util.function.LongFunction<? extends java.util.stream.LongStream> mapper) |
DistributedLongStream |
limit(long maxSize)
Returns a stream consisting of the elements of this stream, truncated
to be no longer than
maxSize in length. |
default DistributedLongStream |
map(DistributedLongUnaryOperator mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
DistributedLongStream |
map(java.util.function.LongUnaryOperator mapper) |
default DistributedDoubleStream |
mapToDouble(DistributedLongToDoubleFunction mapper)
Returns a
DoubleStream consisting of the results of applying the
given function to the elements of this stream. |
DistributedDoubleStream |
mapToDouble(java.util.function.LongToDoubleFunction mapper) |
default DistributedIntStream |
mapToInt(DistributedLongToIntFunction mapper)
Returns an
IntStream consisting of the results of applying the
given function to the elements of this stream. |
DistributedIntStream |
mapToInt(java.util.function.LongToIntFunction mapper) |
default <U> DistributedStream<U> |
mapToObj(DistributedLongFunction<? 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.LongFunction<? extends U> mapper) |
default boolean |
noneMatch(DistributedLongPredicate predicate)
Returns whether no elements of this stream match the provided predicate.
|
boolean |
noneMatch(java.util.function.LongPredicate predicate) |
DistributedLongStream |
parallel()
Returns an equivalent stream that is parallel.
|
default DistributedLongStream |
peek(DistributedLongConsumer 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.
|
DistributedLongStream |
peek(java.util.function.LongConsumer action) |
default OptionalLong |
reduce(DistributedLongBinaryOperator op)
Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
OptionalLong describing the reduced value,
if any. |
OptionalLong |
reduce(java.util.function.LongBinaryOperator op) |
default long |
reduce(long identity,
DistributedLongBinaryOperator 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.
|
long |
reduce(long identity,
java.util.function.LongBinaryOperator op) |
DistributedLongStream |
sequential()
Returns an equivalent stream that is sequential.
|
DistributedLongStream |
skip(long n)
Returns a stream consisting of the remaining elements of this stream
after discarding the first
n elements of the stream. |
DistributedLongStream |
sorted()
Returns a stream consisting of the elements of this stream in sorted
order.
|
average, builder, concat, count, empty, findAny, findFirst, forEach, forEachOrdered, generate, iterate, iterator, max, min, of, of, range, rangeClosed, spliterator, sum, summaryStatistics, toArray
close, isParallel, onClose, unordered
default DistributedLongStream filter(DistributedLongPredicate predicate)
This is an intermediate operation.
predicate
- a non-interfering,
stateless
predicate to apply to each element to determine if it
should be includeddefault DistributedLongStream map(DistributedLongUnaryOperator mapper)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementdefault <U> DistributedStream<U> mapToObj(DistributedLongFunction<? 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 DistributedIntStream mapToInt(DistributedLongToIntFunction 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 mapToDouble(DistributedLongToDoubleFunction mapper)
DoubleStream
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 DistributedLongStream flatMap(DistributedLongFunction<? extends java.util.stream.LongStream> 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
LongStream
of new valuesDistributedStream.flatMap(com.hazelcast.jet.function.DistributedFunction)
DistributedLongStream distinct()
This is a stateful intermediate operation.
distinct
in interface java.util.stream.LongStream
DistributedLongStream sorted()
This is a stateful intermediate operation.
sorted
in interface java.util.stream.LongStream
default DistributedLongStream peek(DistributedLongConsumer 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 streamDistributedLongStream limit(long maxSize)
maxSize
in length.
This is a short-circuiting stateful intermediate operation.
limit
in interface java.util.stream.LongStream
maxSize
- the number of elements the stream should be limited toIllegalArgumentException
- if maxSize
is negativeDistributedLongStream 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.LongStream
n
- the number of leading elements to skipIllegalArgumentException
- if n
is negativedefault long reduce(long identity, DistributedLongBinaryOperator op)
long result = identity;
for (long element : this stream)
result = accumulator.applyAsLong(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 valuesLongStream.sum()
,
LongStream.min()
,
LongStream.max()
,
LongStream.average()
default OptionalLong reduce(DistributedLongBinaryOperator op)
OptionalLong
describing the reduced value,
if any. This is equivalent to:
boolean foundAny = false;
long result = null;
for (long element : this stream) {
if (!foundAny) {
foundAny = true;
result = element;
}
else
result = accumulator.applyAsLong(result, element);
}
return foundAny ? OptionalLong.of(result) : OptionalLong.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(long, LongBinaryOperator)
default <R> R collect(DistributedSupplier<R> supplier, DistributedObjLongConsumer<R> accumulator, DistributedBiConsumer<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 (long element : this stream)
accumulator.accept(result, element);
return result;
Like reduce(long, LongBinaryOperator)
, 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(DistributedLongPredicate 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 false
default boolean allMatch(DistributedLongPredicate 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 false
default boolean noneMatch(DistributedLongPredicate 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 false
DistributedDoubleStream asDoubleStream()
DoubleStream
consisting of the elements of this stream,
converted to double
.
This is an intermediate operation.
asDoubleStream
in interface java.util.stream.LongStream
DoubleStream
consisting of the elements of this stream,
converted to double
DistributedStream<Long> boxed()
Stream
consisting of the elements of this stream,
each boxed to a Long
.
This is an intermediate operation.
boxed
in interface java.util.stream.LongStream
Stream
consistent of the elements of this stream,
each boxed to Long
DistributedLongStream sequential()
This is an intermediate operation.
sequential
in interface java.util.stream.BaseStream<Long,java.util.stream.LongStream>
sequential
in interface java.util.stream.LongStream
DistributedLongStream parallel()
This is an intermediate operation.
parallel
in interface java.util.stream.BaseStream<Long,java.util.stream.LongStream>
parallel
in interface java.util.stream.LongStream
DistributedLongStream filter(java.util.function.LongPredicate predicate)
filter
in interface java.util.stream.LongStream
DistributedLongStream map(java.util.function.LongUnaryOperator mapper)
map
in interface java.util.stream.LongStream
<U> DistributedStream<U> mapToObj(java.util.function.LongFunction<? extends U> mapper)
mapToObj
in interface java.util.stream.LongStream
DistributedIntStream mapToInt(java.util.function.LongToIntFunction mapper)
mapToInt
in interface java.util.stream.LongStream
DistributedDoubleStream mapToDouble(java.util.function.LongToDoubleFunction mapper)
mapToDouble
in interface java.util.stream.LongStream
DistributedLongStream flatMap(java.util.function.LongFunction<? extends java.util.stream.LongStream> mapper)
flatMap
in interface java.util.stream.LongStream
DistributedLongStream peek(java.util.function.LongConsumer action)
peek
in interface java.util.stream.LongStream
long reduce(long identity, java.util.function.LongBinaryOperator op)
reduce
in interface java.util.stream.LongStream
OptionalLong reduce(java.util.function.LongBinaryOperator op)
reduce
in interface java.util.stream.LongStream
<R> R collect(java.util.function.Supplier<R> supplier, java.util.function.ObjLongConsumer<R> accumulator, java.util.function.BiConsumer<R,R> combiner)
collect
in interface java.util.stream.LongStream
boolean anyMatch(java.util.function.LongPredicate predicate)
anyMatch
in interface java.util.stream.LongStream
boolean allMatch(java.util.function.LongPredicate predicate)
allMatch
in interface java.util.stream.LongStream
boolean noneMatch(java.util.function.LongPredicate predicate)
noneMatch
in interface java.util.stream.LongStream
DistributedLongStream configure(JobConfig jobConfig)
jobConfig
- Job configuration which will be used while executing underlying DAGCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.