import java.util.*;
import java.util.stream.*;
var names = List.of("Mark", "Ann", "Paul");
// *** before: ***
List<String> upper1 = names.stream()
.map(String::toUpperCase)
.collect(Collectors.toList());
// *** in version 16: ***
List<String> upper2 = names.stream()
.map(String::toUpperCase)
.toList(); // shorter, and the list is unmodifiable
System.out.println(upper1);
System.out.println(upper2);
// upper2.add("X"); // <- UnsupportedOperationException