O'Reilly logo
live online training icon Live Online training

Programming with Java Lambdas and Streams

Douglas Schmidt

Attendees in this course will learn how to develop programs using powerful object-oriented and functional programming language features and frameworks supported by Java 8. This live online training presents an introduction to Java 8's functional programming features, including lambda expressions, method references, and functional interfaces. These core features provide the foundation for the Java 8 streams framework, which supports functional-style operations on streams of elements, such as map-reduce transformations on Java collections.

This course provides the introductory material for developers who need training on Java 8 Lambdas and Streams before taking the next sequence of courses:

Scalable Programming with the Java 8 Parallel Streams—Java 8 Concurrency Series, Part 2 Reactive Programming with the Java 8 Completable Futures—Java 8 Concurrency Series, Part 3

What you'll learn-and how you can apply it

  • Develop efficient sequential programs using powerful Java 8 object-oriented and functional programming language features and frameworks.
  • Recognize the inherent and accidental complexities involved with developing software for Java 8 clients and servers.
  • Understand how common software patterns and Java 8 programming mechanisms can and cannot help to alleviate this complexity.
  • Know where to find additional sources of information on how to successfully develop robust sequential programs using Java 8.

This training course is for you because...

  • For software developers creating scalable apps on modern multi-core processors in Java.

Prerequisites

This training is intended for software developers who are familiar with:

  • General object-oriented design and programming concepts, such as encapsulation, abstraction, polymorphism, extensibility, and the Unified Modeling Language (UML)
  • Core object-oriented programming language features, such as classes, inheritance, dynamic binding, and generics, that are available in Java
  • Need to know how to download and install the Java 8 JDK and JRE
  • Need to know how to download and install an IDE, such as IntelliJ, NetBeans, Eclipse, or Android Studio

Materials, downloads, or Supplemental Content needed in advance:

An installed copy of the Java 8 JDK and JRE An installed copy of IntelliJ, NetBeans, Eclipse, or Android Studio

Resources:

LiveLessons: Java Concurrency (2nd edition) (video)

LiveLessons: Design Patterns in Java (video)

About your instructor

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Segment 1 Overview of Java 8 Concepts (10mins)

  • Instructor will give an overview of functional programming and compare/contrast Java 8’s functional programming features with its object-oriented features
  • Participants will learn how Java 8 combines functional programming with object-oriented programming.

Segment 2 Overview of Java 8 Lambda Expressions and Method References (15mins)

  • Instructor will explain how Java 8 lambda expressions and method references provide a more concise means of expressing functions and avoiding the verbosity of anonymous inner classes in Java programs.
  • Participants will learn by example how to program with Java 8 lambda expressions and method references.

Segment 3 Overview of Java 8 Functional Interfaces (20mins)

  • Instructor will give an overview of Java 8 functional interfaces, focusing on Functions, BiFunctions, Predicates, Suppliers, and Consumers.
  • Participants will learn by example how to program with Java 8 functional interfaces.

Break (5 minutes)

Segment 4 Applying Basic Java 8 Features (15mins)

Segment 5 Overview of Java 8 Streams (25mins)

  • Instructor will explain the key concepts and programming elements in the Java 8 streams framework, including aggregate operations and terminal operations, as well as spliterators and collectors. The focus of this course will be on sequential streams since parallel streams will be covered in another Live Training course.
  • Participants will understand the fundamentals of Java 8 streams programming.

Segment 6 Java 8 Streams Factory Methods (15mins)

  • Instructors will show by example various ways to create sequential and parallel streams using various factory methods provided by Java 8.
  • Participants will learn the roughly 10 different ways to create sequential and parallel streams.
  • Assignment Title, Link, Description (optional)

Break (5 minutes)

Segment 7 External vs. Internal Iteration in Java 8 (15mins)

  • Instructors will describe the pros and cons of external iteration (which was common in Java 7 and earlier versions) and internal iteration (which is now supported by Java 8 streams).
  • Participants will understand why Java 8 introduced the internal iteration concept and know how it’s used in Java 8 sequential and parallel streams.

Segment 8 Applying Java 8 Sequential Streams to the SearchStreamGang App (25mins)

  • Instructor will conduct a design and code walkthrough of the StreamStreamGang app, which shows how to apply Java 8 sequential streams to search for words or phrases in large text files.
  • Participants will learn how to apply Java 8 sequential streams in practice based on the SearchStreamGang program, which is available as open-source from https://github.com/douglascraigschmidt/LiveLessons/tree/master/SearchStreamGang.

Segment 4 Contrasting Java 8 Streams with Other Java Libraries (10mins)

  • Instructors will compare and contrast Java 8 streams framework with other Java libraries, such as Java I/O and the Java Collections Framework
  • Participants will appreciate how Java 8 streams builds upon earlier object-oriented concepts, features, and frameworks in Java to provide more powerful hybrid functional and object-oriented programming capabilities.

Segment 5 Pros and Cons of Java 8 Streams (10mins)

  • Instructor will summarize the pros and cons of Java 8 parallel streams, focusing how to successfully apply the features provided by this framework in practice.
  • Participants will learn when and how to apply Java 8 parallel streams, as well as know when not to apply Java 8 parallel streams.