Quick Answer
Immutable collections (List.of(), Set.of(), Map.of() - Java 9+) can never be modified - add/remove/set throw UnsupportedOperationException and also disallow null elements. Unmodifiable collections (Collections.unmodifiableList()) are wrappers that reject mutations but the underlying collection can still be changed (through the original reference). Immutable is safer and allows more optimizations.
Answer
Immutable collections cannot change after creation. Unmodifiable collections prevent modification through wrapper but underlying data may still change. Both enhance safety.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.