O'Reilly logo

Java: A Beginner’s Tutorial, 4th Edition (Updated for Java SE 8) by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 19

Lambda Expressions

The lambda expression is the most important new feature in Java SE 8. Long considered a missing feature in Java, it has made the Java language complete. At least for now. In this chapter you will learn what lambda expressions are and why they are a nice addition to the language. You will also be introduced to new technical terms such as single abstract method (SAM) and functional interface as well as learn about method references.

Why Lambda Expressions?

Also known as closures, lambda expressions can make certain constructs shorter and more readable, especially when you are dealing with inner classes.

Consider the following code snippet that defines an anonymous inner class out of the java.lang.Runnable interface ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required