T
- the type of the stream elementspublic interface DistributedStream<T> extends Stream<T>
Stream
that supports distributed stream
operations by replacing functional interfaces with their Serializable
equivalents.Modifier and Type | Interface and Description |
---|---|
static class |
DistributedStream.Cache
Wrapper class that avoids the runtime dependency of
DistributedStream on javax.cache . |
Stream.Builder<T>
builder, collect, concat, count, empty, findAny, findFirst, forEach, forEachOrdered, generate, iterate, of, of, toArray, toArray
close, isParallel, iterator, onClose, spliterator
static <T> DistributedStream<T> fromSource(JetInstance instance, BatchSource<T> source, boolean isOrdered)
Stream
with the given BatchSource
as
the source.instance
- the instance where the stream will be executed onsource
- source of the streamisOrdered
- whether the source should be treated as ordered or unordered. An ordered stream
will not have any parallelism.@Nonnull static <K,V> DistributedStream<Map.Entry<K,V>> fromMap(@Nonnull IMapJet<K,V> map)
DistributedStream
with this map as its source.
If the underlying map is being concurrently modified, there are no guarantees given with respect to missing or duplicate items in a stream operation.
@Nonnull static <K,V,T> DistributedStream<T> fromMap(@Nonnull IMapJet<K,V> map, @Nonnull Predicate<K,V> predicate, @Nonnull DistributedFunction<Map.Entry<K,V>,T> projectionFn)
DistributedStream
with this map as its source.
Entries will be filtered and mapped according to the given predicate
and projection.
If the underlying map is being concurrently modified, there are no guarantees given with respect to missing or duplicate items in a stream operation.
To create a Predicate
instance you might prefer to use Jet's
GenericPredicates
.
@Nonnull static <T> DistributedStream<T> fromList(IListJet<T> list)
DistributedStream
with this list as its
source.default DistributedStream<T> filter(DistributedPredicate<? super T> predicate)
Serializable
variant of
java.util.stream.Stream#filter(Predicate)
.default <R> DistributedStream<R> map(DistributedFunction<? super T,? extends R> mapper)
Serializable
variant of
java.util.stream.Stream#map(Function)
.default DistributedIntStream mapToInt(DistributedToIntFunction<? super T> mapper)
Serializable
variant of
java.util.stream.Stream#mapToInt(ToIntFunction)
.default DistributedLongStream mapToLong(DistributedToLongFunction<? super T> mapper)
Serializable
variant of
java.util.stream.Stream#mapToLong(ToLongFunction)
.default DistributedDoubleStream mapToDouble(DistributedToDoubleFunction<? super T> mapper)
Serializable
variant of
java.util.stream.Stream#mapToDouble(ToDoubleFunction)
.default <R> DistributedStream<R> flatMap(DistributedFunction<? super T,? extends Stream<? extends R>> mapper)
Serializable
variant of
java.util.stream.Stream#flatMap(Function)
.default DistributedIntStream flatMapToInt(DistributedFunction<? super T,? extends IntStream> mapper)
Serializable
variant of
java.util.stream.Stream#flatMapToInt(Function)
.default DistributedLongStream flatMapToLong(DistributedFunction<? super T,? extends LongStream> mapper)
Serializable
variant of
java.util.stream.Stream#flatMapToLong(Function)
.default DistributedDoubleStream flatMapToDouble(DistributedFunction<? super T,? extends DoubleStream> mapper)
Serializable
variant of
java.util.stream.Stream#flatMapToDouble(Function)
.DistributedStream<T> distinct()
DistributedStream<T> sorted()
default DistributedStream<T> sorted(DistributedComparator<? super T> comparator)
Serializable
variant of
java.util.stream.Stream#sorted(Comparator)
.default DistributedStream<T> peek(DistributedConsumer<? super T> action)
Serializable
variant of
java.util.stream.Stream#peek(Consumer)
.DistributedStream<T> limit(long maxSize)
DistributedStream<T> skip(long n)
default T reduce(T identity, DistributedBinaryOperator<T> accumulator)
Serializable
variant of
java.util.stream.Stream#reduce(Object, BinaryOperator)
.default Optional<T> reduce(DistributedBinaryOperator<T> accumulator)
Serializable
variant of
java.util.stream.Stream#reduce(BinaryOperator)
.default <U> U reduce(U identity, DistributedBiFunction<U,? super T,U> accumulator, DistributedBinaryOperator<U> combiner)
Serializable
variant of
java.util.stream.Stream#reduce(Object, BiFunction, BinaryOperator)
.default <R> R collect(DistributedSupplier<R> supplier, DistributedBiConsumer<R,? super T> accumulator, DistributedBiConsumer<R,R> combiner)
Serializable
variant of
java.util.stream.Stream#collect(Supplier, BiConsumer, BiConsumer)
.default <R,A> R collect(DistributedCollector<? super T,A,R> collector)
Serializable
variant of
java.util.stream.Stream#collect(Collector)
.<R> R collect(DistributedCollector.Reducer<? super T,R> reducer)
DistributedCollector.Reducer
and return the resulting value.
A DistributedCollector.Reducer
is specific to Jet, and is responsible for building
and executing the underlying DAG. It can't be used as a downstream collector in a
collector cascade.
R
- type of the return valuereducer
- the reducerdefault Optional<T> min(DistributedComparator<? super T> comparator)
Serializable
variant of
java.util.stream.Stream#min(Comparator)
.default Optional<T> max(DistributedComparator<? super T> comparator)
Serializable
variant of
java.util.stream.Stream#max(Comparator)
.default boolean anyMatch(DistributedPredicate<? super T> predicate)
Serializable
variant of
java.util.stream.Stream#anyMatch(Predicate)
.default boolean allMatch(DistributedPredicate<? super T> predicate)
Serializable
variant of
java.util.stream.Stream#allMatch(Predicate)
.default boolean noneMatch(DistributedPredicate<? super T> predicate)
Serializable
variant of
java.util.stream.Stream#noneMatch(Predicate)
.DistributedStream<T> sequential()
sequential
in interface BaseStream<T,Stream<T>>
DistributedStream<T> parallel()
parallel
in interface BaseStream<T,Stream<T>>
DistributedStream<T> unordered()
unordered
in interface BaseStream<T,Stream<T>>
DistributedStream<T> filter(Predicate<? super T> predicate)
<R> DistributedStream<R> map(Function<? super T,? extends R> mapper)
DistributedIntStream mapToInt(ToIntFunction<? super T> mapper)
DistributedLongStream mapToLong(ToLongFunction<? super T> mapper)
DistributedDoubleStream mapToDouble(ToDoubleFunction<? super T> mapper)
mapToDouble
in interface Stream<T>
<R> DistributedStream<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
DistributedIntStream flatMapToInt(Function<? super T,? extends IntStream> mapper)
flatMapToInt
in interface Stream<T>
DistributedLongStream flatMapToLong(Function<? super T,? extends LongStream> mapper)
flatMapToLong
in interface Stream<T>
DistributedDoubleStream flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
flatMapToDouble
in interface Stream<T>
DistributedStream<T> sorted(Comparator<? super T> comparator)
DistributedStream<T> peek(Consumer<? super T> action)
T reduce(T identity, BinaryOperator<T> accumulator)
Optional<T> reduce(BinaryOperator<T> accumulator)
<U> U reduce(U identity, BiFunction<U,? super T,U> accumulator, BinaryOperator<U> combiner)
<R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner)
DistributedStream<T> configure(JobConfig jobConfig)
jobConfig
- Job configuration which will be used while executing underlying DAGCopyright © 2018 Hazelcast, Inc.. All rights reserved.