AiTeky Original Interactive Learning & Practice Intermediate
Java collections: shared references, defensive copies and the right container
See why a getter that returns your internal list lets callers change your object behind your back, how a defensive copy fixes it, how to pick a list, set or map by counting steps, and fix a report that scans a list inside a loop.
In Java, a variable that holds an object holds a reference: a pointer to the object, not a copy of it. Two variables can point at the same object, and a change through one is visible through the other. Most collection bugs in real Java code come from this, and from choosing a container whose cost does not fit the way it is used.
This course models both with small Python programs you can run in your browser. Python stands in for Java: the code is not Java, but references, copies and lookup costs behave the same way. Check the Java documentation for exact syntax, such as unmodifiable views and copy factory methods. All numbers are made up.
- Learn lessons explain one idea at a time and let you run it.
- Industry ready lessons decide and justify, and end with interview questions.
No Java experience is assumed. Basic Python helps.
- ▶ Run code in your browser. Nothing to install
- ✓ Exercises that check themselves
- 📖 Tap a word to see what it means
Locked. Sign up free
Learn
Understand each idea with everyday examples. No coding background needed.
- 01 25 min Free sample 🔒 AiTeky Pass Two names, one object See how a getter that returns an internal list lets callers change the object, and fix it with a defensive copy.
- 02 25 min 🔒 AiTeky Pass Pick the container by counting steps Count the steps a list and a set need to answer "is this here?" and see why the cost per question matters when you ask it many times.
Industry ready
Real problems from real jobs, and the questions interviewers ask about them.

