Java 9 introduced factory methods for creating unmodifiable collections conveniently.
Source Code
List list = List.of("one", "two", "three");
Set set = Set.of(1, 2, 3);
Map map = Map.of("key1", "value1", "key2", "value2");
Use these factory methods to create collections that are inherently immutable, making your applications safer from accidental modifications.