unmodifiable view

A wrapper around a collection that rejects writes but still shows changes the owner makes to the underlying collection.

In more detail

An unmodifiable view stops callers modifying your data, but they can still see it change later. If a caller must get a stable snapshot, give them a defensive copy instead.

Example

Collections.unmodifiableList(items)

Related terms

Taught in

References

Certification courses