...
In Java 9, Map.of and Set.of were introduced. These are static factory methods which took take values on the fly and returned return Unmodifiable maps/sets which contained contain those values.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Map<String, String> immutableMap = Map.of("A", "Apple", "B", "Ball", "C", "Car") |
...