Created
April 10, 2017 10:05
-
-
Save kodaitakahashi/d2f83f31211e12efe746541777954b0c to your computer and use it in GitHub Desktop.
This file contains 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
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.List; | |
public class Stream1 { | |
public static void main(String[] args) { | |
List<String> strings = Arrays.asList("b", "a", "d"); | |
for (int i = 0; i < strings.size(); i++) { | |
strings.set(i, strings.get(i).toUpperCase()); | |
} | |
System.out.println("-----------Stream なし--------------"); | |
Collections.sort(strings); | |
for (String string : strings) { | |
System.out.println(string); | |
} | |
System.out.println("-----------Stream あり--------------"); | |
strings.stream().sorted().forEach(System.out::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment