Created
December 4, 2016 10:09
-
-
Save hasefumi23/c5174c311d2087512e2a3605b39ac1e3 to your computer and use it in GitHub Desktop.
スタイリッシュなFizzBuzz(Java8) ref: http://qiita.com/F_H_23/items/e18f8e1686bedf31d93e
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 class FizzBuzz { | |
| public static void main(String[] args) { | |
| IntStream.rangeClosed(1, 100).mapToObj(n -> | |
| (n % 15 == 0) ? "FizzBuzz" : | |
| (n % 3 == 0) ? "Fizz" : | |
| (n % 5 == 0) ? "Buzz" : | |
| String.valueOf(n)) | |
| .collect(Collectors.toList()).forEach(System.out::println); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment