What does it mean for a collection to be final in Java? [duplicate]
This question already has an answer here: Why can final object be modified? 7 answers What does it mean for a collection to be declared final in Java? Is it that no more elements can be added to it? Is it that the elements already there cannot be changed? Is it something else? No. It simply means that the reference cannot be changed. final List list = new LinkedList(); .... list.add(someObject); //okay list.remove(someObject); //okay list = new LinkedList(); //not okay list = refToSomeOtherList; //not okay You are getting confused between final and immutable Objects. final --> You cannot