From Collections to Streams in Java 8 Using Lambda Expressions

This course shows the new patterns introduced in Java 8, based on lambda expressions, the functional interfaces, the Collection Framework and the Stream API.
Course info
Rating
(228)
Level
Intermediate
Updated
Sep 15, 2015
Duration
4h 1m
Table of contents
Lambda Expressions and Functional Interfaces
Writing Data Processing Functions with Lambdas in Java 8
Data Processing Using Lambdas and the Collection Framework
Implementing Map Filter Reduce Using Lambdas and Collections
The Stream API, How to Build Streams, First Patterns
Description
Course info
Rating
(228)
Level
Intermediate
Updated
Sep 15, 2015
Duration
4h 1m
Description

Java 8 brought many new patterns to build efficient and clean applications. In this course, we cover one most important new thing: lambda expressions. Lambdas are a nice thing, but would be useless without new patterns to process data. These new patterns have been added to the Collection Framework, and to a the new Stream API. This course quickly explains what the map / filter / reduce pattern is about, and why is has been added to the Stream API. This new API is precisely described: how it can be used to efficiently process data and how it can be used in parallel. Caveats and corner cases are also shown.

About the author
About the author

Passionate about programming computers for over 20 years, Jose made his debut in assembler and C, C for SIMD parallel machines before adopting Java as an object-oriented language. Assistant professor in Paris North University for more than 15 years, Jose also brings his expertise to many projects, in various industrial fields.

More from the author
Eclipse for Java Developers
Intermediate
3h 22m
5 Apr 2018
Java Fundamentals: Input/Output
Intermediate
3h 56m
19 Dec 2017
More courses by Jose Paumard
Section Introduction Transcripts
Section Introduction Transcripts

Writing Data Processing Functions with Lambdas in Java 8
Hello and welcome to this second module of this course about writing data processing functions with lambdas in Java 8. What are we going to see in this module? Well we are going to first define the notion of functional interface and to see example of such functional interface. In a nutshell, a functional interface is the type of a lambda expression, so it has to be defined very precisely. And then we see the java. util. function package. This package is where all the main functional interfaces, all the most important functional interfaces have been put. It is the toolbox used in the map/filter/reduce pattern, the collection framework, and the stream API, all things that we will see later in this course. So we need to go through this package and present the main categories of functional interfaces added in it. And then we will see the predicate example. We are going to recreate a special functional interface from this package, the predicate interface, and we will see how we can build new kinds of APIs for our Java applications.

Data Processing Using Lambdas and the Collection Framework
Hello and welcome to the third module of this course, Data Processing Using Lambdas and the Collection Framework. What are we going to see in this module? Well this module is about the collection framework and how the collection framework has been rewritten to leverage this new tool we have in the Java language called lambda expressions. The collection framework is divided into two great categories, the first one is the collection category itself with iterable, collection, list, set, et cetera. And the second one is the map category that provides implementations for HashMaps. We are going to see both categories and all the new methods that have been added to them. Of course, all throughout this course we will see patterns of code, many examples extracted from real data processing algorithms.

Implementing Map Filter Reduce Using Lambdas and Collections
Welcome to the fourth module of this course, Implementing Map Filter Reduce Using Lambdas and Collections. Let us quickly browse through the agenda of this course. First, we are going to talk about the map/filter/reduce algorithm itself presented, present each one of its steps, the mapping, the filtering, and the reduction step. We will focus on the reduction step. Why? Because it is probably the tricky step of the three and we are going to see that in detail. And then we will see how to implement this algorithm in the JDK and of course since most of the time our data is in an instance of a collection, whether it is a collection or a HashMap, we are going to see how to implement that using collections and we will see caveats, _____ cases, cases where it does not work that well.

The Stream API, How to Build Streams, First Patterns
Welcome to the fifth module of this course, The Stream API, How to Build Streams, First Patterns. This module is all about the Stream API and we will begin by defining exactly what is this new concept introduced in the JDK 8, what is a stream? We need to go through this part to precisely understand what is this concept exactly. Then we will see patterns to build Streams and especially to connect streams to our data, which most of the time lies in collections or arrays. We will also see how our first streams pattern, the mapping, the filtering, and basic reduction steps, and we will see how to build more complex reductions. We will once again use optionals, so we will see more hints on optionals too.