The usage of this final is final variable, which means that the reference of the searchableList variable cannot be changed and has been locked on that ArrayList, but the ArrayList itself can be changed.
Final modifies the heap memory space pointed to by the searchableList variable. For example, searchableList is your house. Being modified by final means that the house will not change anymore, but the content inside can be changed. You can also add things to the house. Go in or delete updates, etc.
The final modified searchableList is a reference, and this reference points to ArrayList<String>, so searchableList cannot be modified, and ArrayList is implemented with an array, and new elements can be added to this array. When you try to modify the object ed pointed to by searchableList, an error is reported
The searchableList variable itself cannot be modified, but the object pointed to by searchableList can be modified.
The usage of this final is final variable, which means that the reference of the searchableList variable cannot be changed and has been locked on that ArrayList, but the ArrayList itself can be changed.
Final modifies the heap memory space pointed to by the searchableList variable. For example, searchableList is your house. Being modified by final means that the house will not change anymore, but the content inside can be changed. You can also add things to the house. Go in or delete updates, etc.
The final modified searchableList is a reference, and this reference points to ArrayList<String>, so searchableList cannot be modified, and ArrayList is implemented with an array, and new elements can be added to this array.
When you try to modify the object ed pointed to by searchableList, an error is reported