Skip to content

Instantly share code, notes, and snippets.

@sarbull
Created October 10, 2016 11:51
Show Gist options
  • Save sarbull/a44b9877cae5ea1bc6d450c9d3e62cc1 to your computer and use it in GitHub Desktop.
Save sarbull/a44b9877cae5ea1bc6d450c9d3e62cc1 to your computer and use it in GitHub Desktop.
Java Streams
package learning;
import java.util.*;
public class Main {
public static void main(String [] args) {
System.out.println("Hello world!");
List<String> myList = Arrays.asList("a1", "a2", "c3", "c5", "cezar", "ana", "constanta");
myList
.stream()
.filter(s -> s.startsWith("c"))
.map(String::toUpperCase)
.sorted()
.forEach(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment