Lambdas and Streams in Java 8

By Klaus Kreft & Angelika Langer

Java 8 comes with several new language features. First, there is support for expressing anonymous functions: Java 8 has lambda expressions and method/constructor references for this purpose. Second, interface methods can have an implementation in Java 8: there are default methods and static methods in interfaces in addition to the well-known abstract interface methods.

Lambda expressions are essential in conjunction with new JDK abstractions such as Stream, ComputableFuture and the like. These new JDK APIs are clumsy to use without lambdas and method references. The non- abstract interface methods were used for the design and implementation of the new JDK APIs.

The JDK's collection framework is radically overhauled in Java 8: it has bulk operations that take functions and apply them to all elements in a collection. The session provides an overview of the new operations and some insight into their inner workings. The centerpiece of the new API is the interface We will explore what streams are, how they differ from collections, how their operations are executed (in parallel or sequentially), why some operations are intermediate and others terminal, why most operations are stateless, and what fluent programming is.

Audience: Java developers with an interest in Java 8.

Level: intermediate

Prerequisite: basic knowledge of Java

Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED

By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED

Settings can be changed at any time from the Cookie Policy page.