Functional Programming with Streams in Java 9
What you’ll learn
Understanding the principles of functional programming and how they contribute to safe parallelism
Understanding the new features of Java interfaces, including the notion of functional interface
Using lambda expressions and functional interfaces, as a lean alternative to anonymous classes
Using streams to perform computations on sequences of data
Using streams to seamlessly perform parallel computations with the Java 9 SDK
Java 8 introduced a wealth of new features, pushing Java towards the
so-called functional programming paradigm. Benefits from this shift
include succinctness and ease of developing robust multi-threaded
In this course, we will introduce the key functional
features of Java 8 and 9, and explain how they can be used to write
code that is more expressive and easily amenable to parallelization.
we will first discuss lambda functions and functional interfaces. Using
these features, programmers can easily create objects that offer a
single specific service, similarly to anonymous classes. We will also
explore the predefined functional interfaces that can be found in the
Java API, starting from well-known pre-existing ones like Comparator and
Reaping the full benefits of lambda functions requires
employing them with streams, a new kind of collection with built-in
parallelization support. We will examine the relationship between
streams and collections, and how the latter have changed as a result of
the new language features.
Finally, after having mastered the key
features of streams, we will consider the details related to parallel
execution, such as the crucial notion of side-effect and the fork-join
About the Author :
Marco Faella is a professor of Computer Science at the
University of Naples “Federico II”, Italy. He has taught classes on Java
programming, compiler construction, and software engineering to
undergraduate and graduate students since 2005. He is the author of over
50 scientific publications in international conferences and journals.
He has also developed scientific software in C++, OCaml, Python, and
Marco is fluent in C, C++, OCaml, Python, and Java and has
contributed to the Parma Polyhedra Library, a well-known scientific
library for symbolic manipulation of polyhedra.
He has an extensive teaching experience in related topics,
specifically a course on advanced Java programming with generics,
collections, and multi-threading, which he has been teaching for the
last 10 years (Linguaggi di Programmazione 2). He’s also writing 4
chapters of an upcoming book (in Italian) on Oracle OCP Java
Who this course is for:
- This course is intended for all Java programmers who want to take full advantage of the new functional features of Java, including the opportunity to easily parallelize performance-critical sections of code.
- Experienced programmers and senior engineers who have already been exposed to the functional paradigm will also benefit from the course, by quickly picking up the Java way to blend object-oriented and functional programming.
- To follow the course at full speed, the audience is supposed to be familiar with most Java 5 features, including generics and multi-threading, and with the basic interfaces and classes from the Java Collection Framework, namely lists, sets, and iterators.
- Upon completion, viewers will be able to employ the functional features of Java 9 to write code that is clearer, more efficient and easier to maintain.
- Introducing Functional Programming
- Lambda Expressions
- Functional Interfaces
- Sequential Data Processing with Streams
- Stream Operations
- Parallel Streams
- Functional Exercise