Skip to content

Instantly share code, notes, and snippets.

@koduki
Last active October 9, 2016 22:42
Show Gist options
  • Save koduki/589471d2b4d32f2638e00dab5e9b9c5c to your computer and use it in GitHub Desktop.
Save koduki/589471d2b4d32f2638e00dab5e9b9c5c to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
SparkConf sparkConf = new SparkConf()
.setMaster("local[*]")
.setAppName("Example01");
JavaSparkContext sc = new JavaSparkContext(sparkConf);
sc.parallelize(IntStream.range(1, 100).boxed().collect(Collectors.toList())).map(x -> {
return (x % 15 == 0) ? "FizzBuzz"
: (x % 5 == 0) ? "Fizz"
: (x % 3 == 0) ? "Buzz"
: x.toString();
}).foreach(x -> System.out.println(x));
sc.stop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment