Streams API in Java


The Streams API supports functional-style operations on streams of elements, such as map-reduce transformations on collections.

Source Code

List myList = Arrays.asList("a1", "a2", "b1", "c2", "c1");
myList
    .stream()
    .filter(s -> s.startsWith("c"))
    .map(String::toUpperCase)
    .sorted()
    .forEach(System.out::println); // C1 C2
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments