Skip to content

Instantly share code, notes, and snippets.

@jon-ruckwood
Created January 15, 2014 18:41
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 jon-ruckwood/8441835 to your computer and use it in GitHub Desktop.
Save jon-ruckwood/8441835 to your computer and use it in GitHub Desktop.
IntStream.range(1, 100).mapToObj(num -> {
final StringBuilder sb = new StringBuilder(8);
if (num % 3 == 0) {
sb.append("Fizz");
}
if (num % 5 == 0) {
sb.append("Buzz");
}
if (sb.length() == 0) {
sb.append(num);
}
return sb.toString();
}).forEach(System.out::println);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment