Skip to content

Instantly share code, notes, and snippets.

@aiya000
Created June 28, 2014 15:28
Show Gist options
  • Save aiya000/567c1b84c9e1240b792e to your computer and use it in GitHub Desktop.
Save aiya000/567c1b84c9e1240b792e to your computer and use it in GitHub Desktop.
import java.util.Optional;
import java.util.stream.*;
public class FizzBuzz8 {
public static void main(String[] args){
Stream.iterate(1, n -> n+1)
.map(
n -> n + ": " + ((n%3)==0 ? (n%5)==0 ? "FizzBuzz"
: "Buzz"
: (n%5)==0 ? "Fizz"
: ""
)
).limit(30)
.forEach(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment