Created
April 4, 2023 16:19
-
-
Save ozuma/c534604ff5d9ae74a58cb7a3985df126 to your computer and use it in GitHub Desktop.
String, Arrays, stream, startsWith
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.Stream; | |
public class stringStreamTest { | |
public static void main(String[] args) { | |
String[] arr = { "NYC", "Mexico", "BeiJing", "New Delhi", "Tokyo" }; | |
Stream<String> stream = Arrays.asList(arr).stream(); | |
stream.filter(s -> s.startsWith("N")) | |
.forEach(System.out::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment