Collections that do not support any modification operations (such as,
remove) are referred to as unmodifiable. [...] Collections that additionally guarantee that no change in the Collection object will ever be visible are referred to as immutable.
Unmodifiable collections are usually read-only views (wrappers) of other collections. You can't add, remove or clear them, but the underlying collection can change.
Immutable collections can't be changed at all - they don't wrap another collection - they have their own elements.
Here's a quote from guava's
Collections.unmodifiableList(java.util.List<? extends T>), which is a view of a separate collection that can still change, an instance of
ImmutableListcontains its own private data and will never change.
So, basically, in order to get an immutable collection out of a mutable one, you have to copy its elements to the new collection, and disallow all operations.