1
Overview of what's new in Java 8
- General view of additions: 195 new entities (classes, interfaces, etc.).
- Lambda expressions.
- Writing SQL code in Java 8 code.
- Default implementations of interfaces and @FunctionalInterface, new annotations.
- Upgrades to streams.
- The new date and time management API.
- Upgrades to the APIs java.lang, java.util, java.net, etc.
- The ability to run JavaScript code with Java 8 Nashorn.
Hands-on work
Verifying that JDK 8 has been installed (tools, javadoc, etc.).
2
Lambda expressions
- Notion of embedded anonymous classes, improvements made by the lambda expression concept.
- Syntactical aspects (declaration, implementation, passing parameters, range of variables, etc.)
- The concept of a “functor” through “functional” interfaces and the java.util.function package.
- Using lambda-expressions to work with collections.
- Contributions in writing SQ code. Listeners...
Hands-on work
Discovering lambda-expressions.
3
Advanced functional programming
- The use of @FunctionalInterface.
- Functional interfaces provided by JDK 8.
- Predicate, Function, Supplier, Consumer, etc.
- References to methods and constructors.
Hands-on work
Implementing advanced aspects
4
Java 8 Nashorn
- JavaScript within Java? From Rhino in Java 7 to Oracle Nashorn, the ECMAScript-262 engine of Java 8.
- Using the jjs command line.
- Calling JavaScript code from a Java application, either directly or with a separate .js file.
- Calling Java code from a JavaScript script.
Hands-on work
JavaScript calls from Java.
5
New Date and Time API
- The difficulties caused by the Date and GregorianCalendar APIs, the JodaTime alternative, and JSR 310.
- The concepts of machine time and human time, the basic principles of the new API.
- Machine time management with java.time.Instant and java.time.Duration.
- Human time with java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime.
Hands-on work
Using the new date and time management API.
6
Other new features
- The new streams.
- Map-reduce.
Hands-on work
Implementing new features.