Search in sources :

Example 1 with DistributedCollectors.toMap

use of com.hazelcast.jet.stream.DistributedCollectors.toMap in project hazelcast-jet-reference-manual by hazelcast.

the class JUS method s3.

static void s3() {
    JetInstance jet = Jet.newJetInstance();
    // tag::s3[]
    // <1>
    IMapJet<String, String> map = jet.getMap("large_map");
    Map<String, String> result = DistributedStream.fromMap(map).map(e -> e.getKey() + e.getValue()).collect(// <2>
    DistributedCollectors.toMap(v -> v, v -> v));
// end::s3[]
}
Also used : Arrays(java.util.Arrays) JetInstance(com.hazelcast.jet.JetInstance) IMapJet(com.hazelcast.jet.IMapJet) Collectors(java.util.stream.Collectors) DistributedFunctions.wholeItem(com.hazelcast.jet.function.DistributedFunctions.wholeItem) Sources(com.hazelcast.jet.pipeline.Sources) IMap(com.hazelcast.core.IMap) DistributedCollectors(com.hazelcast.jet.stream.DistributedCollectors) Stream(java.util.stream.Stream) Map(java.util.Map) IList(com.hazelcast.core.IList) DistributedStream(com.hazelcast.jet.stream.DistributedStream) Jet(com.hazelcast.jet.Jet) DistributedCollectors.toMap(com.hazelcast.jet.stream.DistributedCollectors.toMap) JetInstance(com.hazelcast.jet.JetInstance)

Aggregations

IList (com.hazelcast.core.IList)1 IMap (com.hazelcast.core.IMap)1 IMapJet (com.hazelcast.jet.IMapJet)1 Jet (com.hazelcast.jet.Jet)1 JetInstance (com.hazelcast.jet.JetInstance)1 DistributedFunctions.wholeItem (com.hazelcast.jet.function.DistributedFunctions.wholeItem)1 Sources (com.hazelcast.jet.pipeline.Sources)1 DistributedCollectors (com.hazelcast.jet.stream.DistributedCollectors)1 DistributedCollectors.toMap (com.hazelcast.jet.stream.DistributedCollectors.toMap)1 DistributedStream (com.hazelcast.jet.stream.DistributedStream)1 Arrays (java.util.Arrays)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1