Last active
October 9, 2016 22:42
-
-
Save koduki/589471d2b4d32f2638e00dab5e9b9c5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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