Use Java 8 Stream API
Java 8 stream-based applications can be boosted by making the computation distributed using Hazelcast Jet.
The popular Java 8 java.util.stream is a set of classes to support functional style operations on streams of elements, mostly on collections. Hazelcast Jet implements java.util.stream API in a distributed way.
Hazelcast Jet has an implementation of java.util.stream for Hazelcast IMDG IMap and IList. java.util.stream operations are mapped to a DAG and then executed, and the result returned to the user. The computation is run as distributed and parallelized. Jet benefits from data locality – if the data source and Jet are colocated Jet will read local data partitions and process data in-place to avoid unnecessary shuffling and sending over the wire.
Due to it’s simplicity, the Stream API is a great way to get started with Hazelcast Jet:
IMap<String, Long> counts = lines .stream() .flatMap(word -> Stream.of(word.split("\\W+"))) .collect(DistributedCollectors.toIMap(w -> w, w -> 1L, (left, right) -> left + right)); System.out.println("Counts=" + counts);
Visit code samples for distributed java.util.stream.Jet in 5 minutes