Skip to main content
PreparationZone Logo
PrepZone

Lambda Syntax & SAM Types

From anonymous classes to `->`, target typing, and effectively final capture rules.

Pass checkpoint below

Why this matters

  • Lambdas are the entry point to streams, CompletableFuture, and essentially every modern Java API.
  • Interviewers expect mid-level fluency here — not JVM bytecode on day one, but correct syntax and capture rules.
Sourcelist.stream()
filterKeep some
mapTransform each
collectTerminal — runs everything
Nothing runs until the terminal operation. The intermediate steps only describe the work, which is why a pipeline without collect() or forEach() does nothing at all.

From anonymous class to lambda

Java
Loading compiler…

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 2 sections

  • Syntax
  • SAM types and target typing

Test yourself

Answer these before moving on — recall is what makes it stick.