Hands-on Java 8 with examples and open discussion about the more relevant new feature of Java 8: lambdas, streams, CompletableFeature, new Date & Time API.
2. Agenda
1. Lambda expressions
2. Stream API
3. Parallel operations
4. Default methods
5. Date time API
6. Optional: null is evil!
7. CompletableFuture
3. Lambda expressions
(lambda (x) (+ x 1)) LISP
function (x) { return x + 1; }; JavaScript
[](auto x) { return x + 1; }; C++11
(int x) => x + 1; C#
(_:Int) + 1 Scala
lambda x: x + 1 Python
x -> x + 1 Haskell
7. Default methods
public interface Person {
String getName();
String getSurname();
default String getFullName() {
return getSurname() + " " + getName();
}
}
Multiple inheritance ?
-> Must implement the method explicitly
8. New Dates API
● LocalDate, LocalTime and LocalDateTime
● ZonedDateTime
● Period vs Duration
● Chronologies
http://www.oracle.com/technetwork/articles/java
/jf14-date-time-2125367.html