Java9 Immutable Collection
https://dzone.com/articles/immutable-collections-in-java-9
https://docs.oracle.com/javase/9/core/creating-immutable-lists-sets-and-maps.htm#JSCOR-GUID-202D195E-6E18-41F6-90C0-7423B2C9B381
List list3 = List.of("One", "Two", "Three");
Set set3 = Set.of("One", "Two", "Three");
Map map = Map.of("One", "1", "Two", "2", "Three", "3");
Creating Immutable Collection (Java8 or lower)
- Collections.unmodifiableList(list) 사용
- Arrays.asList( … ) 사용
- stream.of(….).collect(collectingAndThen(toList(), Collections::unmodifiableList)) 사용
- Guava 라이브러리 사용