Last active
March 19, 2019 09:39
-
-
Save hasefumi23/bf134a201c08b48467ee15cb93dbfb9b to your computer and use it in GitHub Desktop.
Java8版のFizzBuzz。
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