SaveMyCert
Log in
2 of 2 free questions left today·for 5 a day
Applying Object-Oriented Principles in Java Programs

Defensive copies: arrays, lists and unmodifiable views

1 min read · 334 words1Z0-831Updated

In one line: A private field still leaks if callers share its mutable object, so copy on the way in and on the way out; List.copyOf closes both leaks.

You’ve read your 2 free 1Z0-831 lessons

Sign up free to read every lesson — your progress is saved.

Spotted a mistake in this part?

Part 7 of 10Next