11.3 Graphics Supplement

This section introduces lambda expressions. Lambda functions are not limited to graphics and JavaFX, but we present them in the context of creating JavaFX event handlers. Lambda functions are useful in many other contexts, particularly for parallelizing operations to make a program run faster.

Lambda Functions and Event Handlers

Functional programming with lambda expressions was introduced in Java 8. A lambda expression is a nameless function. In functional programming, a function is the same thing as a method. Related concepts include closures, anonymous functions, and function literals. As a nameless function, a lambda expression is essentially a little chunk of code that you can pass around as data but have it treated ...

Get Java: An Introduction to Problem Solving and Programming, 8th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.