AiTeky Original Interactive Learning & Practice Intermediate
Java: equality contracts, garbage collection and latency spikes
See why two objects that "look equal" can still be lost in a hash-based collection unless equals and hashCode agree, how the garbage collector's work follows how fast you create objects, and track down a service whose slow requests come in bursts.
Java runs on the JVM, a runtime that manages memory for you with a garbage collector. That removes whole classes of faults from C and C++, and it leaves two Java-specific traps that catch experienced developers: objects that are not equal when they should be (and the hash collections that then lose them), and pauses caused by the collector when a program creates objects faster than it needs to.
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 the contracts and the counts it shows are those of the real language and runtime. Check the Java documentation for exact syntax and for the collectors in your Java version. 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.
- 00 25 min 🔒 AiTeky Pass Start here: objects, references and equality See that a variable holds a reference to an object, not the object itself, and learn the difference between two names for one thing and two things that look alike.
- 01 30 min Free sample 🔒 AiTeky Pass equals and hashCode must agree Put objects with three different definitions of equality into a hash-based set, see which ones can be found again, and learn the contract (equal objects must have equal hash codes) and why changing a key's fields after inserting it loses it.
- 02 30 min 🔒 AiTeky Pass The garbage collector follows your allocations Model a young generation that fills and is cleaned often, an old generation that fills slowly and is cleaned rarely but with a long pause, and see how the rate you create objects, how long they live, and the size of the heap decide how often and how long the program freezes.
Industry ready
Real problems from real jobs, and the questions interviewers ask about them.

