Friday, April 29, 2016

COLLECTIONS - mutable List vs unmodifiable view of List

When you use Collections.unmodifiableList(list) it will return unmodifiable view of that list, it means you will get an UnsupportedOperationException on add() over that view etc.

But in the same time the list itself remains to be mutable in case it is modified in proper way e.g. by the programm API.

No comments: