import java.util.*;
// *** before: ***
List<String> list1 = Collections.unmodifiableList(
new ArrayList<>(Arrays.asList("a", "b", "c")));
Map<String, Integer> tmp = new HashMap<>();
tmp.put("one", 1);
tmp.put("two", 2);
Map<String, Integer> map1 = Collections.unmodifiableMap(tmp);
// *** in version 9: ***
List<String> list2 = List.of("a", "b", "c");
Set<String> set2 = Set.of("a", "b");
Map<String, Integer> map2 = Map.of("one", 1, "two", 2);
Map.Entry<String, Integer> pair = Map.entry("three", 3);
System.out.println(list2);
System.out.println(map2.get("one"));
// list2.add("d"); // <- UnsupportedOperationException
// List.of("a", null); // <- NullPointerException, null is not allowed