Why is java.util.List.clear () an "optional operation"?
2 answers
It has nothing to do with RAM mine, its GC that Garbage ultimately collects this object.
Its more about cases when I obviously can't do my job.
Example, when you try to get a list from an array by calling Arrays.asList (arrayObject), this list cannot be changed. This operation results in a java.lang.UnsupportedOperationException error.
+3
source to share