ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Setrakyan <dsetrak...@apache.org>
Subject Re: Counting characters example in Ignite in Java8
Date Wed, 04 Mar 2015 01:45:50 GMT
Here is the full version:

--------
try (Ignite ignite = Ignition.start()) {
  Collection<String> words = Arrays.asList("How Many Characters".split("
"));

  // Each closure is given a single word and returns the word's length.
  // Each closure will be executed on a different cluster member.
  Collection<Integer> res = ignite.compute().apply(String::length, words);

  int sum = res.stream().mapToInt(Integer::intValue).sum();

  System.out.println("Total number of characters is '" + sum + "'.");
}
----------

On Tue, Mar 3, 2015 at 5:41 PM, Dmitriy Setrakyan <dsetrakyan@apache.org>
wrote:

> Collection<String> words = Arrays.asList("How Many Characters".split(" "));
>
> // Each closure is given a single word and returns the word's length.
> // Each closure will be executed on a different cluster member.
> Collection<Integer> res = ignite.compute().apply(String::length, words);
>
> int sum = res.stream().mapToInt(Integer::intValue).sum();
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message