A filter inside a map over the other list looks innocent and is quadratic. Counting the comparisons makes the difference concrete: two hundred rows a side is already fifty times more work.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-20