We would like to know how to filter String stream and map to upper case then sort.
/* ww w . j av a 2s.c o m*/ import java.util.Arrays; public class Main { public static void main(String[] args) throws Exception { Arrays.asList("a1", "a2", "b1", "c2", "c1") .stream() .filter(s -> s.startsWith("c")) .map(String::toUpperCase) .sorted() .forEach(System.out::println); } }
The code above generates the following result.