Groovy web console

subscribe to the feed Subscribe
to this
site

Stream-1

Published 4 months ago by Amit with tags Stream
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
List<String> myList = Arrays.asList("a1", "a2", "b1", "c2", "c1");   
myList.stream()        
    .filter{s -> s.startsWith("c")}        
    .map{s-> s.toUpperCase()}        
    .sorted()        
    .forEach{s->println s};