English | MP4 | AVC 1920×1080 | AAC 48KHz 2ch | 5h 3m | 796 MB
eLearning | Skill level: All Levels
Improve your Java 9 programs using Functional techniques
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 applications.
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.
Specifically, 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 Runnable.
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 execution model.
What You Will 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
Introducing Functional Programming
The Course Overview
Installation and Setup
What Is Functional Programming?
Interfaces get a Boost
Some Interfaces are More Functional Than Others
Writing Your First Lambda Expression
Typing Lambda Expressions
Pre-Existing Functional Interfaces
New Functional Interfaces
Functional Interfaces for Primitive Types
Sequential Data Processing with Streams
Comparing Streams, Collections, and Iterators
Creating a Stream
Understanding Lazy Evaluation
Streams as Monads
Filtering Stream Elements
Transforming and Rearranging Stream Elements
Basic Terminal Operations
Reductions and Collectors
Streams of Primitive Types
Recognizing and Avoiding Statefulness and Side Effects
Using Parallel Streams
Looking Under the Hood: The fork-join framework
2D Collision Detection
Two-Phase Collision Detection