1926 views.
package com.learnbyexamples.streams;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class E007_TransformStreamUsingMap {
public static void main(String[] args) {
//List of names
List<String> names = new ArrayList<>();
names.add("JOHN");
names.add("PETER");
names.add("SHIVA");
//Transform all strings into lowercase
List<String> lowerNames = names.stream().map(String::toLowerCase).collect(Collectors.toList());
//Prints the list
System.out.println(lowerNames);
}
}