public interface DistributedIntStream extends java.util.stream.IntStream
IntStream
that supports distributed stream
operations by replacing functional interfaces with their serializable
equivalents.java.util.stream.IntStream.Builder
Modifier and Type | Method and Description |
---|---|
default boolean |
allMatch(DistributedIntPredicate predicate)
Returns whether all elements of this stream match the provided predicate.
|
boolean |
allMatch(java.util.function.IntPredicate predicate) |
default boolean |
anyMatch(DistributedIntPredicate predicate)
Returns whether any elements of this stream match the provided
predicate.
|
boolean |
anyMatch(java.util.function.IntPredicate predicate) |
DistributedDoubleStream |
asDoubleStream()
Returns a
DoubleStream consisting of the elements of this stream,
converted to double . |
DistributedLongStream |
asLongStream()
Returns a
LongStream consisting of the elements of this stream,
converted to long . |
DistributedStream<Integer> |
boxed()
Returns a
Stream consisting of the elements of this stream,
each boxed to an Integer . |
default <R> R |
collect(DistributedSupplier<R> supplier,
DistributedObjIntConsumer<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.ObjIntConsumer<R> accumulator,
java.util.function.BiConsumer<R,R> combiner) |
DistributedIntStream |
configure(JobConfig jobConfig) |
DistributedIntStream |
distinct()
Returns a stream consisting of the distinct elements of this stream.
|
default DistributedIntStream |
filter(DistributedIntPredicate predicate)
Returns a stream consisting of the elements of this stream that match
the given predicate.
|
DistributedIntStream |
filter(java.util.function.IntPredicate predicate) |
default DistributedIntStream |
flatMap(DistributedIntFunction<? extends java.util.stream.IntStream> 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.
|
DistributedIntStream |
flatMap(java.util.function.IntFunction<? extends java.util.stream.IntStream> mapper) |
DistributedIntStream |
limit(long maxSize)
Returns a stream consisting of the elements of this stream, truncated
to be no longer than
maxSize in length. |
default DistributedIntStream |
map(DistributedIntUnaryOperator mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
DistributedIntStream |
map(java.util.function.IntUnaryOperator mapper) |
default DistributedDoubleStream |
mapToDouble(DistributedIntToDoubleFunction mapper)
Returns a
DistributedDoubleStream consisting of the results of applying the
given function to the elements of this stream. |
DistributedDoubleStream |
mapToDouble(java.util.function.IntToDoubleFunction mapper) |
default DistributedLongStream |
mapToLong(DistributedIntToLongFunction mapper)
Returns a
DistributedLongStream consisting of the results of applying the
given function to the elements of this stream. |
DistributedLongStream |
mapToLong(java.util.function.IntToLongFunction mapper) |
default <U> DistributedStream<U> |
mapToObj(DistributedIntFunction<? extends U> mapper)
Returns an object-valued
DistributedStream consisting of the results of
applying the given function to the elements of this stream. |
<U> DistributedStream<U> |
mapToObj(java.util.function.IntFunction<? extends U> mapper) |
default boolean |
noneMatch(DistributedIntPredicate predicate)
Returns whether no elements of this stream match the provided predicate.
|
boolean |
noneMatch(java.util.function.IntPredicate predicate) |
DistributedIntStream |
parallel()
Returns an equivalent stream that is parallel.
|
default DistributedIntStream |
peek(DistributedIntConsumer 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.
|
DistributedIntStream |
peek(java.util.function.IntConsumer action) |
default OptionalInt |
reduce(DistributedIntBinaryOperator op)
Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
OptionalInt describing the reduced value,
if any. |
OptionalInt |
reduce(java.util.function.IntBinaryOperator op) |
default int |
reduce(int identity,
DistributedIntBinaryOperator 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.
|
int |
reduce(int identity,
java.util.function.IntBinaryOperator op) |
DistributedIntStream |
sequential()
Returns an equivalent stream that is sequential.
|
DistributedIntStream |
skip(long n)
Returns a stream consisting of the remaining elements of this stream
after discarding the first
n elements of the stream. |
DistributedIntStream |
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 DistributedIntStream filter(DistributedIntPredicate predicate)
This is an intermediate operation.
predicate
- a non-interfering,
stateless
predicate to apply to each element to determine if it
should be includeddefault DistributedIntStream map(DistributedIntUnaryOperator mapper)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementdefault <U> DistributedStream<U> mapToObj(DistributedIntFunction<? extends U> mapper)
DistributedStream
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(DistributedIntToLongFunction mapper)
DistributedLongStream
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(DistributedIntToDoubleFunction mapper)
DistributedDoubleStream
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 flatMap(DistributedIntFunction<? extends java.util.stream.IntStream> 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 an
IntStream
of new valuesDistributedStream.flatMap(com.hazelcast.jet.function.DistributedFunction)
DistributedIntStream distinct()
This is a stateful intermediate operation.
distinct
in interface java.util.stream.IntStream
DistributedIntStream sorted()
This is a stateful intermediate operation.
sorted
in interface java.util.stream.IntStream
default DistributedIntStream peek(DistributedIntConsumer 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 streamDistributedIntStream limit(long maxSize)
maxSize
in length.
This is a short-circuiting stateful intermediate operation.
limit
in interface java.util.stream.IntStream
maxSize
- the number of elements the stream should be limited toIllegalArgumentException
- if maxSize
is negativeDistributedIntStream 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.IntStream
n
- the number of leading elements to skipIllegalArgumentException
- if n
is negativedefault int reduce(int identity, DistributedIntBinaryOperator op)
int result = identity;
for (int element : this stream)
result = accumulator.applyAsInt(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 valuesIntStream.sum()
,
IntStream.min()
,
IntStream.max()
,
IntStream.average()
default OptionalInt reduce(DistributedIntBinaryOperator op)
OptionalInt
describing the reduced value,
if any. This is equivalent to:
boolean foundAny = false;
int result = null;
for (int element : this stream) {
if (!foundAny) {
foundAny = true;
result = element;
}
else
result = accumulator.applyAsInt(result, element);
}
return foundAny ? OptionalInt.of(result) : OptionalInt.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(int, DistributedIntBinaryOperator)
default <R> R collect(DistributedSupplier<R> supplier, DistributedObjIntConsumer<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 (int element : this stream)
accumulator.accept(result, element);
return result;
Like reduce(int, DistributedIntBinaryOperator)
, 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 functionDistributedStream.collect(DistributedSupplier, DistributedBiConsumer, DistributedBiConsumer)
default boolean anyMatch(DistributedIntPredicate 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(DistributedIntPredicate 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(DistributedIntPredicate 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
DistributedLongStream asLongStream()
LongStream
consisting of the elements of this stream,
converted to long
.
This is an intermediate operation.
asLongStream
in interface java.util.stream.IntStream
LongStream
consisting of the elements of this stream,
converted to long
DistributedDoubleStream asDoubleStream()
DoubleStream
consisting of the elements of this stream,
converted to double
.
This is an intermediate operation.
asDoubleStream
in interface java.util.stream.IntStream
DoubleStream
consisting of the elements of this stream,
converted to double
DistributedStream<Integer> boxed()
Stream
consisting of the elements of this stream,
each boxed to an Integer
.
This is an intermediate operation.
boxed
in interface java.util.stream.IntStream
Stream
consistent of the elements of this stream,
each boxed to an Integer
DistributedIntStream sequential()
This is an intermediate operation.
sequential
in interface java.util.stream.BaseStream<Integer,java.util.stream.IntStream>
sequential
in interface java.util.stream.IntStream
DistributedIntStream parallel()
This is an intermediate operation.
parallel
in interface java.util.stream.BaseStream<Integer,java.util.stream.IntStream>
parallel
in interface java.util.stream.IntStream
DistributedIntStream filter(java.util.function.IntPredicate predicate)
filter
in interface java.util.stream.IntStream
DistributedIntStream map(java.util.function.IntUnaryOperator mapper)
map
in interface java.util.stream.IntStream
<U> DistributedStream<U> mapToObj(java.util.function.IntFunction<? extends U> mapper)
mapToObj
in interface java.util.stream.IntStream
DistributedLongStream mapToLong(java.util.function.IntToLongFunction mapper)
mapToLong
in interface java.util.stream.IntStream
DistributedDoubleStream mapToDouble(java.util.function.IntToDoubleFunction mapper)
mapToDouble
in interface java.util.stream.IntStream
DistributedIntStream flatMap(java.util.function.IntFunction<? extends java.util.stream.IntStream> mapper)
flatMap
in interface java.util.stream.IntStream
DistributedIntStream peek(java.util.function.IntConsumer action)
peek
in interface java.util.stream.IntStream
int reduce(int identity, java.util.function.IntBinaryOperator op)
reduce
in interface java.util.stream.IntStream
OptionalInt reduce(java.util.function.IntBinaryOperator op)
reduce
in interface java.util.stream.IntStream
<R> R collect(java.util.function.Supplier<R> supplier, java.util.function.ObjIntConsumer<R> accumulator, java.util.function.BiConsumer<R,R> combiner)
collect
in interface java.util.stream.IntStream
boolean anyMatch(java.util.function.IntPredicate predicate)
anyMatch
in interface java.util.stream.IntStream
boolean allMatch(java.util.function.IntPredicate predicate)
allMatch
in interface java.util.stream.IntStream
boolean noneMatch(java.util.function.IntPredicate predicate)
noneMatch
in interface java.util.stream.IntStream
DistributedIntStream configure(JobConfig jobConfig)
jobConfig
- Job configuration which will be used while executing underlying DAGCopyright © 2017 Hazelcast, Inc.. All Rights Reserved.