Java Lambdas And Functional Interfaces

Lambdas, method references and the functional interfaces they implement: what a lambda captures and what that costs, why its this differs from an anonymous class's, when a method reference is clearer, choosing among the standard java.util.function interfaces instead of inventing one, primitive specialisations that avoid boxing, checked exceptions inside lambdas, and the runtime shape (invokedynamic, capturing versus non-capturing, megamorphic call sites). Use when a lambda captures mutable state or a large object, when a codebase reinvents Function or Predicate, when checked exceptions force a try/catch inside a pipeline, or when a queued lambda outlives what it captured. Stream pipelines are java-streams, inlining is jit-inlining-and-escape-analysis, and per-request context a lambda must not capture is scoped-values.

robsonkades 079e480 4 files · 25.7 KB Updated

File contents

robsonkades/agent-skills/tree/main/skills/java-lambdas-and-functional-interfaces commit 079e4800b6

Frequently asked questions

npx skillmds@latest add robsonkades/java-lambdas-and-functional-interfaces