+ 1

How to make Java Arraylist Read-only?

28th Nov 2020, 4:50 AM
Priyanka Gotugade.
Priyanka Gotugade. - avatar
3 Respostas
28th Nov 2020, 5:07 AM
ㅤㅤㅤ
+ 3
Easiest way: List<String> immutable = List.of("I", "see", "fire"); See details in https://www.baeldung.com/java-immutable-list
28th Nov 2020, 4:59 AM
Tibor Santa
Tibor Santa - avatar
0
Make list as final, you cannot change but only you can add...
28th Nov 2020, 11:51 AM
Jayakrishna 🇮🇳