Question
Which statement about CopyOnWriteArrayList is the strongest interview answer?
- CopyOnWriteArrayList is mostly a naming style choice and has little effect on runtime or design.
- CopyOnWriteArrayList exists mainly to reduce the number of Java files in a project.
- CopyOnWriteArrayList makes a fresh backing array on writes so readers can iterate safely without explicit synchronization.
- CopyOnWriteArrayList matters only for frontend frameworks, not for core Java applications.
Hint
Start with the core rule behind CopyOnWriteArrayList.
Answer and rationale
Correct answer: C. CopyOnWriteArrayList makes a fresh backing array on writes so readers can iterate safely without explicit synchronization.
CopyOnWriteArrayList makes a fresh backing array on writes so readers can iterate safely without explicit synchronization. This is the base concept interviewers commonly test first.
Track: Java