Created
April 4, 2023 16:53
-
-
Save ozuma/55fcc654c1ca3d8517d30bac023c628f to your computer and use it in GitHub Desktop.
Java, stream, Arrays
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
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
import java.util.stream.Stream; | |
class StreamArrayTest | |
{ | |
public static void main(String[] args) | |
{ | |
Stream<String> stream = Stream.of("NYC", "Mexico", "Beijing", "New Delhi", "Tokyo"); | |
String[] str = stream.collect(Collectors.toList()).toArray(new String[0]); | |
System.out.println(Arrays.toString(str)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment