List.subList does not copy. It returns a window onto the original, and any structural change to the parent makes every method on that window throw - which turns a caching or pagination helper into a landmine.
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-08-25