Search code snippets, questions, articles...

Java 8 Stream

List<String> myList =
    Arrays.asList("a1", "a2", "b1", "c2", "c1");

myList
    .stream()
    .filter(s -> s.startsWith("c"))
    .map(String::toUpperCase)
    .sorted()
    .forEach(System.out::println);

https://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/

Was this helpful?
0 Comments