Lambdas and Streams Master Class Part 1 José Paumard, Stuart Marks voxxed

preview_player
Показать описание

What is the state of lambda expressions in Java 11? Lambda expressions are the major feature of Java 8, having an impact on most of the API, including the Streams and Collections API. We are now living the Java 11 days; new features have been added and new patterns have emerged. This highly technical Deep Dive session will visit all these patterns, the well-known ones and the new ones, in an interactive hybrid of lecture and laboratory. We present a technique and show how it helps solve a problem. We then present another problem, and give you some time to solve it yourself. Finally, we present a solution, and open for questions, comments, and discussion. Bring your laptop set up with JDK 11 and your favorite IDE, and be prepared to think!

This session is part 1 of 2 parts. In part 1 we will cover lambdas, functional interfaces, default methods, higher-order functions, and comparators.

José Paumard
From JPEFI
José is a developer, architect, application designer and instructor with 20 years experience in Java technologies and software craftsmanship. He is an assistant professor in Paris. He is a recognized expert, Java Champion and Java Rockstar. His recent work includes Java 8, lambda expressions, the Stream API and concurrent programming.

Stuart Marks
From Oracle
Stuart Marks is a Consulting Member of Technical Staff in the Java Platform Group at Oracle. He is currently working on a variety of JDK core libraries projects, including Collections, Lambda, and Streams, as well as improving test quality and performance. As his alter ego "Dr Deprecator" he also works on the Java SE deprecation mechanism. He has previously worked on JavaFX and Java ME at Sun Microsystems. He has over twenty years of software platform product development experience in the areas of window systems, interactive graphics, and mobile and embedded systems. Stuart holds a Master's degree in Computer Science and a Bachelor's degree in Electrical Engineering from Stanford University.
Рекомендации по теме
Комментарии
Автор

This is one of the best conferences I've seen in my entire life. Jose is a total master in Java and Lambdas, it was a brilliant exhibition from him.

matheusc.
Автор

Introduction
3:25 LambdaHOL GitHub link
8:16 Lambda Test classes GitHub link

Funtional Interfaces
8:56 What is Functional Interface
13:14 First Lambda Expression example
18:14 Types of Functional Interfaces

Consumer
20:35 First Consumer Example problem
22:41 Solution
24:00 Method reference
27:55 Second Consumer Example problem
32:07 Solution
30:14 Default methods in Java Interfaces
34:10 chaining Lambda expressions

Predicate
41:20 What is Predicate
42:00 First Predicate Example problem
45:08 Solution
47:28 Abstract Method names in Functional Interfaces
49:07 Second Predicate Example problem
51:10 Solution
53:59 Passing null values in Functional Interfaces
59:33 Third Predicate Example problem
1:03:48 Solution

Comparator
1:08:28 Pre-Lambda Comparator drawbacks
1:15:39 Comparator with Lambda
1:16:50 Explanation of Comparator with Lambda
1:21:38 Writing a custom Person Comparator
1:33:03 Making custom Comparator generic
1:39:40 Chaining Comparators
1:45:00 Comparator that puts null values at the end
1:53:40 Reverse a Comparator ordering

API Design
2:11:20 Currency Converter

ThePurpleList
Автор

Thank you, was always confused about lambdas. Head is so clear and sorted now.

rashigarg
Автор

I'm still waiting for your Generics masterclass :)

jfilipcic
Автор

1:06:40 For those wondering, the reason for ^ being single is that Java has lazy boolean operators: && and ||, where evaluating left part is sometimes enough. However it also has eager versions of them (both parts are always evaluated): &, |. XOR is inherently eager, it always needs to evaluate left and right part, hence single ^.

aral
Автор

Jose to Stuart on the Consumer interface in the JDK: "Well, you can modify it, I cannot, I can only play with it". LOL

zakimirza
Автор

Great video! The Comparator part was kinda hard, I'm comming back to it once I get a better grasp of generics.

ngollo
Автор

I implemented the consumer_2 like below, which also explain quite clearly what was happening

Consumer<List<String>> consumer = (strings) ->{
c1.accept(strings);
c2.accept(strings);
};

ElectroFly
Автор

Absolutely Brilliant!! Well done Gentleman

wwhill
Автор

This duo should do a talk on generics..

jackofnotrades
Автор

There is no ^^ for short-circuit exclusive or because there is no such thing as short-circuiting for xor. For and, we can skip the second test if the first test is false. For or, we can skip the second test if the first test is true. For xor you need to look at both operands every single time...

jvsnyc
Автор

Another way of writing xor : p1.and(p2).negate(); 1:06:27

udaykiran-yidv
Автор

39:45 default andThen() could have been simplified further like this :

@FunctionalInterface
public interface MyConsumer<T> {
void accept(T t);
default MyConsumer<T> andThen(MyConsumer<T> that) {
MyConsumer<T> combinedConsumer = (t) -> {
this.accept(t);
that.accept(t);
};
return combinedConsumer;
}
}

KunalKrishna