Skip to content

Instantly share code, notes, and snippets.

@ozuma
Created April 4, 2023 16:53
Show Gist options
  • Save ozuma/55fcc654c1ca3d8517d30bac023c628f to your computer and use it in GitHub Desktop.
Save ozuma/55fcc654c1ca3d8517d30bac023c628f to your computer and use it in GitHub Desktop.
Java, stream, Arrays
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