Submit Search
Upload
Java 8: Lambdas, Monads and Java Collections - 12.05.2015 @JInkubator
•
1 like
•
637 views
Grzegorz Piwowarek
Follow
This presentation focuses on proper use of new Java 8 features.
Read less
Read more
Technology
Report
Share
Report
Share
1 of 62
Download now
Download to read offline
Recommended
Chapter 4 - Classes in Java
Chapter 4 - Classes in Java
Khirulnizam Abd Rahman
Chapter 3 Arrays in Java
Chapter 3 Arrays in Java
Khirulnizam Abd Rahman
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
John De Goes
Chapter 2 Java Methods
Chapter 2 Java Methods
Khirulnizam Abd Rahman
Humble introduction to category theory in haskell
Humble introduction to category theory in haskell
Jongsoo Lee
Chapter 2 Method in Java OOP
Chapter 2 Method in Java OOP
Khirulnizam Abd Rahman
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)
stasimus
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
John De Goes
Recommended
Chapter 4 - Classes in Java
Chapter 4 - Classes in Java
Khirulnizam Abd Rahman
Chapter 3 Arrays in Java
Chapter 3 Arrays in Java
Khirulnizam Abd Rahman
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
John De Goes
Chapter 2 Java Methods
Chapter 2 Java Methods
Khirulnizam Abd Rahman
Humble introduction to category theory in haskell
Humble introduction to category theory in haskell
Jongsoo Lee
Chapter 2 Method in Java OOP
Chapter 2 Method in Java OOP
Khirulnizam Abd Rahman
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)
stasimus
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
John De Goes
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka Actors
John De Goes
Java cheatsheet
Java cheatsheet
Anass SABANI
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
Fwdays
Halogen: Past, Present, and Future
Halogen: Past, Present, and Future
John De Goes
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
greenwop
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Chris Richardson
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
John De Goes
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Code
stasimus
One Monad to Rule Them All
One Monad to Rule Them All
John De Goes
13 Strings and Text Processing
13 Strings and Text Processing
Intro C# Book
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java API
Mario Fusco
The java language cheat sheet
The java language cheat sheet
anand_study
Scala - where objects and functions meet
Scala - where objects and functions meet
Mario Fusco
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
John De Goes
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
Mario Fusco
A taste of Functional Programming
A taste of Functional Programming
Jordan Open Source Association
OOP v3
OOP v3
Sunil OS
Monadic Java
Monadic Java
Mario Fusco
Python Cheat Sheet
Python Cheat Sheet
Muthu Vinayagam
Unlocking the Magic of Monads with Java 8
Unlocking the Magic of Monads with Java 8
JavaDayUA
The Road To Monad Transformers
The Road To Monad Transformers
Pawel Lisewski
F sharp - an overview
F sharp - an overview
Christoph Santschi
More Related Content
What's hot
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka Actors
John De Goes
Java cheatsheet
Java cheatsheet
Anass SABANI
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
Fwdays
Halogen: Past, Present, and Future
Halogen: Past, Present, and Future
John De Goes
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
greenwop
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Chris Richardson
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
John De Goes
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Code
stasimus
One Monad to Rule Them All
One Monad to Rule Them All
John De Goes
13 Strings and Text Processing
13 Strings and Text Processing
Intro C# Book
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java API
Mario Fusco
The java language cheat sheet
The java language cheat sheet
anand_study
Scala - where objects and functions meet
Scala - where objects and functions meet
Mario Fusco
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
John De Goes
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
Mario Fusco
A taste of Functional Programming
A taste of Functional Programming
Jordan Open Source Association
OOP v3
OOP v3
Sunil OS
Monadic Java
Monadic Java
Mario Fusco
Python Cheat Sheet
Python Cheat Sheet
Muthu Vinayagam
Unlocking the Magic of Monads with Java 8
Unlocking the Magic of Monads with Java 8
JavaDayUA
What's hot
(20)
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka Actors
Java cheatsheet
Java cheatsheet
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
Halogen: Past, Present, and Future
Halogen: Past, Present, and Future
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Code
One Monad to Rule Them All
One Monad to Rule Them All
13 Strings and Text Processing
13 Strings and Text Processing
Let's make a contract: the art of designing a Java API
Let's make a contract: the art of designing a Java API
The java language cheat sheet
The java language cheat sheet
Scala - where objects and functions meet
Scala - where objects and functions meet
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
A taste of Functional Programming
A taste of Functional Programming
OOP v3
OOP v3
Monadic Java
Monadic Java
Python Cheat Sheet
Python Cheat Sheet
Unlocking the Magic of Monads with Java 8
Unlocking the Magic of Monads with Java 8
Similar to Java 8: Lambdas, Monads and Java Collections - 12.05.2015 @JInkubator
The Road To Monad Transformers
The Road To Monad Transformers
Pawel Lisewski
F sharp - an overview
F sharp - an overview
Christoph Santschi
Monads in Swift
Monads in Swift
Vincent Pradeilles
Functional Reactive Programming without Black Magic (UIKonf 2015)
Functional Reactive Programming without Black Magic (UIKonf 2015)
Jens Ravens
Hierarchical free monads and software design in fp
Hierarchical free monads and software design in fp
Alexander Granin
Introduction to Matlab.pdf
Introduction to Matlab.pdf
ssuser43b38e
Programming python quick intro for schools
Programming python quick intro for schools
Dan Bowen
Kyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdf
Flavio W. Brasil
Legacy lambda code
Legacy lambda code
Peter Lawrey
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
Ruby Meditation
Dnipro conf
Dnipro conf
BotondOrbn
C++11 - A Change in Style - v2.0
C++11 - A Change in Style - v2.0
Yaser Zhian
Anais Dotis-Georgiou & Faith Chikwekwe [InfluxData] | Top 10 Hurdles for Flux...
Anais Dotis-Georgiou & Faith Chikwekwe [InfluxData] | Top 10 Hurdles for Flux...
InfluxData
Advanced Swift Generics
Advanced Swift Generics
Max Sokolov
Monad
Monad
Konstantin (Konst) __
MP in Clojure
MP in Clojure
Kent Ohashi
Types Working for You, Not Against You
Types Working for You, Not Against You
C4Media
[JuraSIC! Meetup] Mateusz Stasch - Monady w .NET
[JuraSIC! Meetup] Mateusz Stasch - Monady w .NET
Future Processing
Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4
Randa Elanwar
Python-The programming Language
Python-The programming Language
Rohan Gupta
Similar to Java 8: Lambdas, Monads and Java Collections - 12.05.2015 @JInkubator
(20)
The Road To Monad Transformers
The Road To Monad Transformers
F sharp - an overview
F sharp - an overview
Monads in Swift
Monads in Swift
Functional Reactive Programming without Black Magic (UIKonf 2015)
Functional Reactive Programming without Black Magic (UIKonf 2015)
Hierarchical free monads and software design in fp
Hierarchical free monads and software design in fp
Introduction to Matlab.pdf
Introduction to Matlab.pdf
Programming python quick intro for schools
Programming python quick intro for schools
Kyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdf
Legacy lambda code
Legacy lambda code
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
Dnipro conf
Dnipro conf
C++11 - A Change in Style - v2.0
C++11 - A Change in Style - v2.0
Anais Dotis-Georgiou & Faith Chikwekwe [InfluxData] | Top 10 Hurdles for Flux...
Anais Dotis-Georgiou & Faith Chikwekwe [InfluxData] | Top 10 Hurdles for Flux...
Advanced Swift Generics
Advanced Swift Generics
Monad
Monad
MP in Clojure
MP in Clojure
Types Working for You, Not Against You
Types Working for You, Not Against You
[JuraSIC! Meetup] Mateusz Stasch - Monady w .NET
[JuraSIC! Meetup] Mateusz Stasch - Monady w .NET
Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4
Python-The programming Language
Python-The programming Language
Recently uploaded
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
TopCSSGallery
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
alexjohnson7307
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
FIDO Alliance
Working together SRE & Platform Engineering
Working together SRE & Platform Engineering
Marcus Vechiato
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
marcuskenyatta275
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
Srushith Repakula
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
Patrick Viafore
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
BrainSell Technologies
Overview of Hyperledger Foundation
Overview of Hyperledger Foundation
Hyperleger Tokyo Meetup
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
Safe Software
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
Hiroshi SHIBATA
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
GDSC PJATK
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
danishmna97
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
Pixlogix Infotech
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
Syngulon
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
Samy Fodil
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
Paolo Missier
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
Recently uploaded
(20)
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
Working together SRE & Platform Engineering
Working together SRE & Platform Engineering
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
Overview of Hyperledger Foundation
Overview of Hyperledger Foundation
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
Java 8: Lambdas, Monads and Java Collections - 12.05.2015 @JInkubator
1.
JAVA 8LAMBDAS, MONADS
&& JAVA COLLECTIONS Grzegorz Piwowarek
2.
GRZEGORZ PIWOWAREK @PIVOVARIT
3.
GRZEGORZ PIWOWAREK @PIVOVARIT visionsoftondal.com
4.
Plan: -lambda expressions -java.util.function -monads -Optional -Stream
5.
lambda expressions (...) ->
statement - Anonymous function
6.
lambda expressions x ->
x + 1
7.
lambda expressions x ->
x + 1 - No type information
8.
lambda expressions x ->
x + 1 () -> 42 () -> {return 42;} (x, y) -> {} () -> {}
9.
method references
10.
java.util.function
11.
java.util.function
12.
java.util.function
13.
Function<T, R>, BiFunction<T,U,R> Consumer<T>
extends Function<T,Void> Supplier<T> extends Function<Void, T> Predicate<T> extends Function<T, Boolean> UnaryOperator<T> extends Function<T, T> BinaryOperator<T> extends BiFunction<T,T,T>
14.
Function<T, R>, BiFunction<T,U,R> Consumer<T>
extends Function<T,Void> Supplier<T> extends Function<Void, T> Predicate<T> extends Function<T, Boolean> UnaryOperator<T> extends Function<T, T> BinaryOperator<T> extends BiFunction<T,T,T>
15.
Function<T, R>, BiFunction<T,U,R> Consumer<T>
extends Function<T,Void> Supplier<T> extends Function<Void, T> Predicate<T> extends Function<T, Boolean> UnaryOperator<T> extends Function<T, T> BinaryOperator<T> extends BiFunction<T,T,T>
16.
Function<T, R>, BiFunction<T,U,R> Consumer<T>
extends Function<T,Void> Supplier<T> extends Function<Void, T> Predicate<T> extends Function<T, Boolean> UnaryOperator<T> extends Function<T, T> BinaryOperator<T> extends BiFunction<T,T,T>
17.
Function<T, R>, BiFunction<T,U,R> Consumer<T>
extends Function<T,Void> Supplier<T> extends Function<Void, T> Predicate<T> extends Function<T, Boolean> UnaryOperator<T> extends Function<T, T> BinaryOperator<T> extends BiFunction<T,T,T>
18.
MONAD
19.
20.
GOOGLE IMAGES...
21.
...
22.
MONAD Design pattern
23.
MONAD Design pattern http://got-steam.com/
24.
Why bother? : Boilerplate
-1 Readability +1 Complexity -1 Responsibility -1
25.
type: M<T> "unit": T
-> M<T> "bind": M<T> bind(T -> M<U>) = M<U> MONAD "bind": M<T> bind(T -> U)= M<U>
26.
type: M<T> "unit": T
-> M<T> "bind": M<T> bind(T -> M<U>) = M<U> MONAD "bind": M<T> bind(T -> U)= M<U>
27.
"bind": M<T> bind(T
-> U)= M<U> What if U: M<?> ?
28.
"bind": M<T> bind(T
-> U)= M<U> What if U: M<?> ? http://www.ivanaborovnjak.com/project/box-in-a-box/
29.
"bind": M<T> bind(T
-> U)= M<U> What if U: M<?> ? http://www.ivanaborovnjak.com/project/box-in-a-box/
30.
Monads in Java
8 Optional Stream CompletableFuture
31.
Monads in Java
8 Optional Stream CompletableFuture
32.
Optional Encapsulation of operations on
optional values
33.
Optional type: M<T> "unit": T
-> M<T> "bind": M<T> bind(T -> M<U>) = M<U>
34.
Optional type: Optional<T> "unit": T
-> M<T> "bind": M<T> bind(T -> M<U>) = M<U>
35.
Optional type: Optional<T> "unit": Optional.ofNullable(),
Optional.of() "bind": M<T> bind(T -> M<U>) = M<U>
36.
Optional type: Optional<T> "unit": Optional.ofNullable(),
Optional.of() "bind": Optional.flatMap()
37.
Filtering an Optional .filter(Predicate<T>)
38.
Unwrapping an Optional .get() .orElse(T
default) .orElseGet(Supplier<T>) .orElseThrow(Supplier<Ex>) .ifPresent(Consumer<T>)
39.
Java 7 style
40.
Java 8 style
41.
Java 8 style
- flatMap
42.
Java 7,5 style
;)
43.
Java 7,5 style
;)
44.
Stream Encapsulation of operations on
multiple items
45.
Stream type: Stream<T> "unit": Stream.of(),
Arrays.stream(), Collection.stream() "bind": Stream.flatMap()
46.
Stream lazy-initialized nonreusable
47.
Java7
48.
Java8
49.
Stream && Optional
50.
intermediate operations .map() .flatMap() .filter() .peek()
51.
intermediate operations .map() .flatMap() .filter() .peek() Stream not
consumed: does not print anything
52.
Consuming Stream .forEach(Consumer<T>) .collect() .reduce(BinaryOperator<T>) .allMatch(), anyMatch(),
noneMatch() .findFirst(), findAny() .count() .toArray()
53.
Stream.reduce()
54.
Collectors .toList(), toMap(), toSet(),
toCollection() .minBy(), maxBy() .joining() .partitioningBy() ...and many others
55.
Collectors.toList()
56.
Collectors.toMap()
57.
Collectors.joining()
58.
Stream in APIs BufferedReader.lines() Files.newDirectoryStream() Random.ints() ...
59.
you want more?
60.
https://github.com/ jasongoodwin/better-java-monads
61.
Thank You!
62.
REFERENCES: -MONADIC JAVA BY
MARIO FUSCO -WHAT'S WRONG WITH JAVA 8 BY PIERRE-YVES SAUMONT -WWW.ORACLE.COM
Download now