+ 1
How to make Java Arraylist Read-only?
3 Answers
+ 5
Priyanka Gotugade. For more info you can visit this link,this link will helps you...
https://www.google.com/amp/s/www.geeksforgeeks.org/how-to-make-an-arraylist-read-only-in-java/amp/
+ 3
Easiest way:
List<String> immutable = List.of("I", "see", "fire");
See details in https://www.baeldung.com/java-immutable-list
0
Make list as final, you cannot change but only you can add...