Skip to content

Instantly share code, notes, and snippets.

@koduki
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koduki/8265b34f5598bafa0843 to your computer and use it in GitHub Desktop.
Save koduki/8265b34f5598bafa0843 to your computer and use it in GitHub Desktop.
long count = IntStream.rangeClosed(1, 100)
.mapToObj(n
-> ((n % 15 == 0)) ? "FizzBuzz"
: (n % 3 == 0) ? "Fizz"
: (n % 5 == 0) ? "Buzz"
: String.valueOf(n))
.peek(x -> System.out.println("debug: " + x)) // print debug
.filter(x -> "FizzBuzz".equals(x))
.count();
System.out.println("count: " + count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment