Java 8 introduces a number of revolutionary capabilities - many of them centered on lambda expressions and functional-style programming. These capabilities add powerful new programming techniques to the language, but also add complexity.
This concise course is focused on introducing the new capabilities and how to use them. It includes numerous code examples and programming labs that illustrate all of the new capabilities.
The course is hands on, and requires that students be comfortable with writing general Java code at an intermediate level, including the use of interfaces.
All labs are done within the Eclipse IDE, and the lab instructions include detailed directions on using it.
Cost: Price on application
Duration: 2 days
This course is not available as part of our public schedule but can be provided on a customised client specific basis.
Participants should be comfortable with writing general Java code at an intermediate level, including the use of interfaces.
Be familiar with the additions to Java interfaces
Understand and use functional interfaces
Understand lambda expressions and method references, and use them to pass behavior (methods)
Learn about the pre-defined functional interfaces, and use them with lambda expressions
Understand and use the Stream API
Process collections using streams, including chaining operations and using collectors
Understand and use parallel streams
Understand and deal with the issues of parallel processing
Learn and use the new Data/Time API
Be familiar with other new capabilities
Motivation for Lambdas
Lambda Expression Overview
Lambda Expressions and Functional Interfaces
Using Lambda Expressions
Working with Method References
The Stream API:
Shortcomings of Collections
What are Streams?
Chaining - Intermediate and Terminal Operations
Understanding the Stream API
Overview - java.util.stream types (Stream, Collector, ...)
Keys to Understanding the API
Important Functional Interfaces: Predicate, Comparator, Function
Sorting / Comparator.comparing()
Other operations: peek(), distinct(), limit(), skip()
Result producing terminal operations - collect, min/max ...
void Terminal Operations - forEach()
Existence (e.g. anyMatch) and Finder (e.g. findAny) Operations
Roles and Capabilities
Supplier and Collectors.toCollection()
Partitioning and Grouping Collectors
Parallel Processing and Concurrency:
Java 8 Parallel Processing using Streams
Ground Rules / Requirements for Using Parallel Stream Processing
Multithreading / Concurrency Issues
Race Conditions, Data Synchronization, Locks
Performance Issues and Considerations
Overview and Limitations of Previous API
The Date/Time API (JSR 310)
Creating and Working with LocalData/LocalTime/LocalDateTime Instances
Localization / Time Zones
Periods and Durations
Performing Calculations on Data/Time types
Using Optional Instead of null
Repeatable and Type Annotations
Minor New Features