SlideShare a Scribd company logo
1 of 47
Master the Concepts Behind the Java 10
Challenges and Eliminate Stressful Bugs
What we will do together...
Learn 10 recently released Java core concepts
by solving fun challenges
Lets learn together…
9 10
Topics we will cover
1. Interface
2. Optional
3. Reactive Streams
4. Try with resources
5. Take and drop while
6. CompletableFuture
7. Type Inference (var!)
8. Collection Factories
9. Functional Interfaces
10. ProcessHandle API
Get to know me...
Rafael Del Nero
- Made in Brazil
- Java Champion
- Quiz master in Oracle Dev Gym
- Creator of the Java Challengers series in Java World
- Creator of nobugsproject.com
- Author of "No Bugs, No Stress - Create a Life Changing
Software Without Destroying Your Life” book.
Topics we will cover – Part I
1. Interface
2. Optional
3. Reactive Streams
4. Try with resources
5. Take and drop while
Interface #1
A) LukeSFSYoda
B) LukeXYoda
C) It won’t compile
D) SLukeFSYoda
Interface #1
A) LukeSFSYoda
B) LukeXYoda
C) It won’t compile
D) SLukeFSYoda
Class != interface
private methods on interfaces
Default methods
Interface #1
A) LukeSFSYoda
B) LukeXYoda
C) It won’t compile
D) SLukeFSYoda
Class != interface
private methods on interfaces
Default methods
Optional #2
A) keyMakerVirus2theOneTRINITY
B) keyMakerVirusArchitect2theOneTRINITY
C) Virus1theOneTRINITY
D) keyMakerVirus1theOne
Optional #2
A) keyMakerVirus2theOneTRINITY
B) keyMakerVirusArchitect2theOneTRINITY
C) Virus1theOneTRINITY
D) keyMakerVirus1theOne
orElse
orElseGet
or
Optional #2
A) keyMakerVirus2theOneTRINITY
B) keyMakerVirusArchitect2theOneTRINITY
C) Virus1theOneTRINITY
D) keyMakerVirus1theOne
Optional #2
A) keyMakerVirus2theOneTRINITY
B) keyMakerVirusArchitect2theOneTRINITY
C) Virus1theOneTRINITY
D) keyMakerVirus1theOne
orElse
orElseGet
or
Reactive Streams #3
A) Homer Barney Lenny
Moe, get the shotgun
B) Homer No beer.
Moe, get the shotgun
C) It will be a random result
D) Homer Barney Lenny
and StackOverflowError will be thrown
Asynchronous process
Reactive Streams #3
A) Homer Barney Lenny
Moe, get the shotgun
B) Homer No beer.
Moe, get the shotgun
C) It will be a random result
D) Homer Barney Lenny
and StackOverflowError will be thrown
Asynchronous process
++ operator
Daemon and non-daemon Thread
Reactive Streams #3
A) Homer Barney Lenny
Moe, get the shotgun
B) Homer No beer.
Moe, get the shotgun
C) It will be a random result
D) Homer Barney Lenny
and StackOverflowError will be thrown
Reactive Streams #3
A) Homer Barney Lenny
Moe, get the shotgun
B) Homer No beer.
Moe, get the shotgun
C) It will be a random result
D) Homer Barney Lenny
and StackOverflowError will be thrown
Asynchronous process
++ operator
Daemon and non-daemon Thread
Try with resources #4
A) IOException will be thrown
B) >#?#1
C) >>#?#2
D) >#? then IOException will be thrown
Try with resources #4
A) IOException will be thrown
B) >#?#1
C) >>#?#2
D) >#? then IOException will be thrown
Closable can be passed from outside since
Java 9
Close method is invoked after try block is
executed
No need to use finally to close resources
Try with resources #4
A) IOException will be thrown
B) >#?#1
C) >>#?#2
D) >#? then IOException will be thrown
Closable can be passed from outside since
Java 9
Close method is invoked after try block is
executed
No need to use finally to close resources
Try with resources #4
A) IOException will be thrown
B) >#?#1
C) >>#?#2
D) >#? then IOException will be thrown
Try with resources #4
A) IOException will be thrown
B) >#?#1
C) >>#?#2
D) >#? then IOException will be thrown
Closable can be passed from outside since
Java 9
Close method is invoked after try block is
executed
No need to use finally to close resources
Take and drop while #5
A) 76578
B) 78657
C) 786578
D) 7 and random values
Take and drop while #5
A) 76578
B) 78657
C) 786578
D) 7 and random values
Take and Drop while will break when the
condition is false
Set interface has unordered elements
Stream.flatMap()
Take and drop while #5
A) 76578
B) 78657
C) 786578
D) 7 and random values
Take and drop while #5
A) 76578
B) 78657
C) 786578
D) 7 and random values
Take and Drop while will break when the
condition is false
Set interface has unordered elements
Stream.flatMap()
6. CompletableFuture
7. Type Inference (var!)
8. Collection Factories
9. Functional Interfaces
10. ProcessHandle API
Topics we will cover – Part II
- Java ==  since 2007
- Consultant @ Version 1
- 💚 Clean Code & TDD
Get to know me...
Barry Evans
- Made in (N) Ireland
- Live in Dublin
- Dublin Java User Group Co-lead
- http://DubJUG.org
- 💔 Bugs & Untested Code
A)
time to go home :( Rating: 0
& the jvm terminates
B)
time to go home :( Rating: 14
& the jvm terminates
C)
time to go home :( Rating: 14
& the jvm does not terminate
D)
Rating: 14 time to go home :(
& the jvm does not terminate
Completable
Future #6
A)
time to go home :( Rating: 0
& the jvm terminates
B)
Rating: 14 time to go home :(
& the jvm terminates
C)
time to go home :( Rating: 14
& the jvm does not terminate
D)
Rating: 14 time to go home :(
& the jvm does not terminate
Completable
Future #6
CF’s – Declarative task pipelines
Good use of Threads
completeAsync() – Java 9
ExecutorService.shutdown()
A) a:c:e:g
B) b:c:f:g
C) b:c:e:g
D) Throws
java.lang.
ClassCastException
at line 21
Type Inference #7
A) a:c:e:g
B) b:c:f:g
C) b:c:e:g
D) Throws
java.lang.
ClassCastException
at line 21
Type Inference #7
Non-Denotable types
Assigning null to var
var is not a keyword
A) a:c:e:g
B) b:c:f:g
C) b:c:e:g
D) Throws
java.lang.
ClassCastException
at line 21
Type Inference #7
A) a:c:e:g
B) b:c:f:g
C) b:c:e:g
D) Throws
java.lang.
ClassCastException
at line 21
Type Inference #7
No compile-time exception checking
A) a:c:e:g
B) b:c:f:g
C) b:c:e:g
D) Throws
java.lang.
ClassCastException
at line 21
Type Inference #7
Non-Denotable types
Assigning null to var
var is not a keyword
A) no space for Marvel
heros here!|Where are
the villains?
B) no space for villains
and exits
C) Harley Quinn, Joker,
Riddler
D) Joker, Riddler, Joker
Collection
Factories #8
A) no space for Marvel
heros here!|Where are
the villains?
B) no space for villains
and exits
C) Harley Quinn, Joker,
Riddler
D) Joker, Riddler, Joker
Collection
Factories #8
of() provides Immutable collections
Set.copyOf() & duplicates 
Set.of() & duplicates 
A) no space for Marvel
heros here!|Where are
the villains?
B) no space for villains
and exits
C) Harley Quinn, Joker,
Riddler
D) Joker, Riddler, Joker
Collection
Factories #8Immutable Collections
Not assigned
Java 10
Duplicates not allowed
A) no space for Marvel
heros here!|Where are
the villains?
B) no space for villains
and exits
C) Harley Quinn, Joker,
Riddler
D) Joker, Riddler, Joker
Collection
Factories #8
of() provides Immutable collections
Set.copyOf() & duplicates 
Set.of() & duplicates 
Functional
Interfaces #9
A) -2
B) 1
C) 4
D) Throws
java.lang.ArithmeticException:
/ by zero
A) -2
B) 1
C) 4
D) Throws
java.lang.ArithmeticException:
/ by zero
Functional
Interfaces #9
A) -2
B) 1
C) 4
D) Throws
java.lang.ArithmeticException:
/ by zero
Assign functional interfaces to fields
andThen() chaining is like a pipe |
Function | BiFunction | BiConsmer
A) -2
B) 1
C) 4
D) Throws
java.lang.ArithmeticException:
/ by zero
Functional
Interfaces #9
= 2
Does nothing
= 4
4
2/4 == 0.5 == 0
A) -2
B) 1
C) 4
D) Throws
java.lang.ArithmeticException:
/ by zero
= 4
1
2
3
4
5
6
A) -2
B) 1
C) 4
D) Throws
java.lang.ArithmeticException:
/ by zero
Functional
Interfaces #9
Assign functional interfaces to fields
andThen() chaining is like a pipe |
Function | BiFunction | BiConsmer
A) Yum Yum Piggy : 0
Yum Yum Piggy : 1
Yum Yum Piggy : 2
B) Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred.
Program will exit.
Unrecognized option: --list-modules
C) Wolf for dinner!
Wolf for dinner!
Yum Yum Piggy : 3
D) Yum Yum Piggy : 1
Yum Yum Piggy : 2
Wolf for dinner!
ProcessHandle API
#10
A) Yum Yum Piggy : 0
Yum Yum Piggy : 1
Yum Yum Piggy : 2
B) Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred.
Program will exit.
Unrecognized option: --list-modules
C) Wolf for dinner!
Wolf for dinner!
Yum Yum Piggy : 3
D) Yum Yum Piggy : 1
Yum Yum Piggy : 2
Wolf for dinner!
ProcessHandle API
#10
ProcessHandle | ProcessHandle.Info
Java 9
liveness, children, pid, destroy
ProcessHandle.onExit() 
CompletableFuture
Topics we covered
1. Interface
2. Optional
3. Reactive Streams
4. Try with resources
5. Take and drop while
6. CompletableFuture
7. Type Inference (var!)
8. Collection Factories
9. Functional Interfaces
10. ProcessHandle API
Have a wonderful @OracleCodeOne!
Master the Concepts Behind the Java 10
Challenges and Eliminate Stressful Bugs
@rafaDelNero @bazza_ni

More Related Content

What's hot

Decompiling Java - SCAM2009 Presentation
Decompiling Java - SCAM2009 PresentationDecompiling Java - SCAM2009 Presentation
Decompiling Java - SCAM2009 PresentationJames Hamilton
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Anton Arhipov
 
Hotfixing iOS apps with Javascript
Hotfixing iOS apps with JavascriptHotfixing iOS apps with Javascript
Hotfixing iOS apps with JavascriptSergio Padrino Recio
 
Aprendendo solid com exemplos
Aprendendo solid com exemplosAprendendo solid com exemplos
Aprendendo solid com exemplosvinibaggio
 
C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)Patricia Aas
 
Thoughts On Learning A New Programming Language
Thoughts On Learning A New Programming LanguageThoughts On Learning A New Programming Language
Thoughts On Learning A New Programming LanguagePatricia Aas
 
Developer Android Tools
Developer Android ToolsDeveloper Android Tools
Developer Android ToolsMacha DA COSTA
 

What's hot (9)

Decompiling Java - SCAM2009 Presentation
Decompiling Java - SCAM2009 PresentationDecompiling Java - SCAM2009 Presentation
Decompiling Java - SCAM2009 Presentation
 
Getting Testy With Perl6
Getting Testy With Perl6Getting Testy With Perl6
Getting Testy With Perl6
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011
 
Hotfixing iOS apps with Javascript
Hotfixing iOS apps with JavascriptHotfixing iOS apps with Javascript
Hotfixing iOS apps with Javascript
 
Smoking docker
Smoking dockerSmoking docker
Smoking docker
 
Aprendendo solid com exemplos
Aprendendo solid com exemplosAprendendo solid com exemplos
Aprendendo solid com exemplos
 
C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)
 
Thoughts On Learning A New Programming Language
Thoughts On Learning A New Programming LanguageThoughts On Learning A New Programming Language
Thoughts On Learning A New Programming Language
 
Developer Android Tools
Developer Android ToolsDeveloper Android Tools
Developer Android Tools
 

Similar to Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs

ITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVM
ITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVMITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVM
ITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVMIstanbul Tech Talks
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015Charles Nutter
 
Code lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzCode lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzIvan Krylov
 
Test First Teaching
Test First TeachingTest First Teaching
Test First TeachingSarah Allen
 
Java Basics
Java BasicsJava Basics
Java BasicsSunil OS
 
JavaProgrammingForBeginners-Presentation.pdf
JavaProgrammingForBeginners-Presentation.pdfJavaProgrammingForBeginners-Presentation.pdf
JavaProgrammingForBeginners-Presentation.pdfSathwika7
 
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaCharles Nutter
 
Learn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful Bugs
Learn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful BugsLearn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful Bugs
Learn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful BugsRafael Chinelato Del Nero
 
Monkeybars in the Manor
Monkeybars in the ManorMonkeybars in the Manor
Monkeybars in the Manormartinbtt
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |ShubhamAthawane
 
Once Upon a Process
Once Upon a ProcessOnce Upon a Process
Once Upon a ProcessDavid Evans
 

Similar to Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs (20)

Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
 
ITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVM
ITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVMITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVM
ITT 2014 - Niklas Therning - Truly Native Java Apps on iOS with RoboVM
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
 
In Vogue Dynamic
In Vogue DynamicIn Vogue Dynamic
In Vogue Dynamic
 
Code lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzCode lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf Linz
 
Test First Teaching
Test First TeachingTest First Teaching
Test First Teaching
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Java introduction
Java introductionJava introduction
Java introduction
 
55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
 
JavaProgrammingForBeginners-Presentation.pdf
JavaProgrammingForBeginners-Presentation.pdfJavaProgrammingForBeginners-Presentation.pdf
JavaProgrammingForBeginners-Presentation.pdf
 
Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
 
Learn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful Bugs
Learn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful BugsLearn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful Bugs
Learn the Concepts Behind Those 10 Java Challenges and Eliminate Stressful Bugs
 
Java Basic PART I
Java Basic PART IJava Basic PART I
Java Basic PART I
 
Intro to J Ruby
Intro to J RubyIntro to J Ruby
Intro to J Ruby
 
Monkeybars in the Manor
Monkeybars in the ManorMonkeybars in the Manor
Monkeybars in the Manor
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |
 
Once Upon a Process
Once Upon a ProcessOnce Upon a Process
Once Upon a Process
 
Java goes wild, lesson 1
Java goes wild, lesson 1Java goes wild, lesson 1
Java goes wild, lesson 1
 
Java For Automation
Java   For AutomationJava   For Automation
Java For Automation
 
Ruby Under The Hood
Ruby Under The HoodRuby Under The Hood
Ruby Under The Hood
 

Recently uploaded

%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 

Recently uploaded (20)

%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 

Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs

  • 1. Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs
  • 2. What we will do together... Learn 10 recently released Java core concepts by solving fun challenges
  • 4. Topics we will cover 1. Interface 2. Optional 3. Reactive Streams 4. Try with resources 5. Take and drop while 6. CompletableFuture 7. Type Inference (var!) 8. Collection Factories 9. Functional Interfaces 10. ProcessHandle API
  • 5. Get to know me... Rafael Del Nero - Made in Brazil - Java Champion - Quiz master in Oracle Dev Gym - Creator of the Java Challengers series in Java World - Creator of nobugsproject.com - Author of "No Bugs, No Stress - Create a Life Changing Software Without Destroying Your Life” book.
  • 6. Topics we will cover – Part I 1. Interface 2. Optional 3. Reactive Streams 4. Try with resources 5. Take and drop while
  • 7. Interface #1 A) LukeSFSYoda B) LukeXYoda C) It won’t compile D) SLukeFSYoda
  • 8. Interface #1 A) LukeSFSYoda B) LukeXYoda C) It won’t compile D) SLukeFSYoda Class != interface private methods on interfaces Default methods
  • 9. Interface #1 A) LukeSFSYoda B) LukeXYoda C) It won’t compile D) SLukeFSYoda Class != interface private methods on interfaces Default methods
  • 10. Optional #2 A) keyMakerVirus2theOneTRINITY B) keyMakerVirusArchitect2theOneTRINITY C) Virus1theOneTRINITY D) keyMakerVirus1theOne
  • 11. Optional #2 A) keyMakerVirus2theOneTRINITY B) keyMakerVirusArchitect2theOneTRINITY C) Virus1theOneTRINITY D) keyMakerVirus1theOne orElse orElseGet or
  • 12. Optional #2 A) keyMakerVirus2theOneTRINITY B) keyMakerVirusArchitect2theOneTRINITY C) Virus1theOneTRINITY D) keyMakerVirus1theOne
  • 13. Optional #2 A) keyMakerVirus2theOneTRINITY B) keyMakerVirusArchitect2theOneTRINITY C) Virus1theOneTRINITY D) keyMakerVirus1theOne orElse orElseGet or
  • 14. Reactive Streams #3 A) Homer Barney Lenny Moe, get the shotgun B) Homer No beer. Moe, get the shotgun C) It will be a random result D) Homer Barney Lenny and StackOverflowError will be thrown Asynchronous process
  • 15. Reactive Streams #3 A) Homer Barney Lenny Moe, get the shotgun B) Homer No beer. Moe, get the shotgun C) It will be a random result D) Homer Barney Lenny and StackOverflowError will be thrown Asynchronous process ++ operator Daemon and non-daemon Thread
  • 16. Reactive Streams #3 A) Homer Barney Lenny Moe, get the shotgun B) Homer No beer. Moe, get the shotgun C) It will be a random result D) Homer Barney Lenny and StackOverflowError will be thrown
  • 17. Reactive Streams #3 A) Homer Barney Lenny Moe, get the shotgun B) Homer No beer. Moe, get the shotgun C) It will be a random result D) Homer Barney Lenny and StackOverflowError will be thrown Asynchronous process ++ operator Daemon and non-daemon Thread
  • 18. Try with resources #4 A) IOException will be thrown B) >#?#1 C) >>#?#2 D) >#? then IOException will be thrown
  • 19. Try with resources #4 A) IOException will be thrown B) >#?#1 C) >>#?#2 D) >#? then IOException will be thrown Closable can be passed from outside since Java 9 Close method is invoked after try block is executed No need to use finally to close resources
  • 20. Try with resources #4 A) IOException will be thrown B) >#?#1 C) >>#?#2 D) >#? then IOException will be thrown Closable can be passed from outside since Java 9 Close method is invoked after try block is executed No need to use finally to close resources
  • 21. Try with resources #4 A) IOException will be thrown B) >#?#1 C) >>#?#2 D) >#? then IOException will be thrown
  • 22. Try with resources #4 A) IOException will be thrown B) >#?#1 C) >>#?#2 D) >#? then IOException will be thrown Closable can be passed from outside since Java 9 Close method is invoked after try block is executed No need to use finally to close resources
  • 23. Take and drop while #5 A) 76578 B) 78657 C) 786578 D) 7 and random values
  • 24. Take and drop while #5 A) 76578 B) 78657 C) 786578 D) 7 and random values Take and Drop while will break when the condition is false Set interface has unordered elements Stream.flatMap()
  • 25. Take and drop while #5 A) 76578 B) 78657 C) 786578 D) 7 and random values
  • 26. Take and drop while #5 A) 76578 B) 78657 C) 786578 D) 7 and random values Take and Drop while will break when the condition is false Set interface has unordered elements Stream.flatMap()
  • 27. 6. CompletableFuture 7. Type Inference (var!) 8. Collection Factories 9. Functional Interfaces 10. ProcessHandle API Topics we will cover – Part II
  • 28. - Java ==  since 2007 - Consultant @ Version 1 - 💚 Clean Code & TDD Get to know me... Barry Evans - Made in (N) Ireland - Live in Dublin - Dublin Java User Group Co-lead - http://DubJUG.org - 💔 Bugs & Untested Code
  • 29. A) time to go home :( Rating: 0 & the jvm terminates B) time to go home :( Rating: 14 & the jvm terminates C) time to go home :( Rating: 14 & the jvm does not terminate D) Rating: 14 time to go home :( & the jvm does not terminate Completable Future #6
  • 30. A) time to go home :( Rating: 0 & the jvm terminates B) Rating: 14 time to go home :( & the jvm terminates C) time to go home :( Rating: 14 & the jvm does not terminate D) Rating: 14 time to go home :( & the jvm does not terminate Completable Future #6 CF’s – Declarative task pipelines Good use of Threads completeAsync() – Java 9 ExecutorService.shutdown()
  • 31. A) a:c:e:g B) b:c:f:g C) b:c:e:g D) Throws java.lang. ClassCastException at line 21 Type Inference #7
  • 32. A) a:c:e:g B) b:c:f:g C) b:c:e:g D) Throws java.lang. ClassCastException at line 21 Type Inference #7 Non-Denotable types Assigning null to var var is not a keyword
  • 33. A) a:c:e:g B) b:c:f:g C) b:c:e:g D) Throws java.lang. ClassCastException at line 21 Type Inference #7
  • 34. A) a:c:e:g B) b:c:f:g C) b:c:e:g D) Throws java.lang. ClassCastException at line 21 Type Inference #7 No compile-time exception checking
  • 35. A) a:c:e:g B) b:c:f:g C) b:c:e:g D) Throws java.lang. ClassCastException at line 21 Type Inference #7 Non-Denotable types Assigning null to var var is not a keyword
  • 36. A) no space for Marvel heros here!|Where are the villains? B) no space for villains and exits C) Harley Quinn, Joker, Riddler D) Joker, Riddler, Joker Collection Factories #8
  • 37. A) no space for Marvel heros here!|Where are the villains? B) no space for villains and exits C) Harley Quinn, Joker, Riddler D) Joker, Riddler, Joker Collection Factories #8 of() provides Immutable collections Set.copyOf() & duplicates  Set.of() & duplicates 
  • 38. A) no space for Marvel heros here!|Where are the villains? B) no space for villains and exits C) Harley Quinn, Joker, Riddler D) Joker, Riddler, Joker Collection Factories #8Immutable Collections Not assigned Java 10 Duplicates not allowed
  • 39. A) no space for Marvel heros here!|Where are the villains? B) no space for villains and exits C) Harley Quinn, Joker, Riddler D) Joker, Riddler, Joker Collection Factories #8 of() provides Immutable collections Set.copyOf() & duplicates  Set.of() & duplicates 
  • 40. Functional Interfaces #9 A) -2 B) 1 C) 4 D) Throws java.lang.ArithmeticException: / by zero
  • 41. A) -2 B) 1 C) 4 D) Throws java.lang.ArithmeticException: / by zero Functional Interfaces #9 A) -2 B) 1 C) 4 D) Throws java.lang.ArithmeticException: / by zero Assign functional interfaces to fields andThen() chaining is like a pipe | Function | BiFunction | BiConsmer
  • 42. A) -2 B) 1 C) 4 D) Throws java.lang.ArithmeticException: / by zero Functional Interfaces #9 = 2 Does nothing = 4 4 2/4 == 0.5 == 0 A) -2 B) 1 C) 4 D) Throws java.lang.ArithmeticException: / by zero = 4 1 2 3 4 5 6
  • 43. A) -2 B) 1 C) 4 D) Throws java.lang.ArithmeticException: / by zero Functional Interfaces #9 Assign functional interfaces to fields andThen() chaining is like a pipe | Function | BiFunction | BiConsmer
  • 44. A) Yum Yum Piggy : 0 Yum Yum Piggy : 1 Yum Yum Piggy : 2 B) Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Unrecognized option: --list-modules C) Wolf for dinner! Wolf for dinner! Yum Yum Piggy : 3 D) Yum Yum Piggy : 1 Yum Yum Piggy : 2 Wolf for dinner! ProcessHandle API #10
  • 45. A) Yum Yum Piggy : 0 Yum Yum Piggy : 1 Yum Yum Piggy : 2 B) Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Unrecognized option: --list-modules C) Wolf for dinner! Wolf for dinner! Yum Yum Piggy : 3 D) Yum Yum Piggy : 1 Yum Yum Piggy : 2 Wolf for dinner! ProcessHandle API #10 ProcessHandle | ProcessHandle.Info Java 9 liveness, children, pid, destroy ProcessHandle.onExit()  CompletableFuture
  • 46. Topics we covered 1. Interface 2. Optional 3. Reactive Streams 4. Try with resources 5. Take and drop while 6. CompletableFuture 7. Type Inference (var!) 8. Collection Factories 9. Functional Interfaces 10. ProcessHandle API
  • 47. Have a wonderful @OracleCodeOne! Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs @rafaDelNero @bazza_ni

Editor's Notes

  1. Non-Denotable types (like Anonymous Classes) can be inferred by var. assigning null to var var is not a keyword cons of using var why did Java use var? - show generics example Gen/1/2/3
  2. Non-Denotable types (like Anonymous Classes) can be inferred by var. assigning null to var var is not a keyword cons of using var why did Java use var? - show generics example Gen/1/2/3
  3. Non-Denotable types (like Anonymous Classes) can be inferred by var. assigning null to var var is not a keyword cons of using var why did Java use var? - show generics example Gen/1/2/3
  4. newInstance() effectively bypasses the compile-time exception checking
  5. Non-Denotable types (like Anonymous Classes) can be inferred by var. assigning null to var var is not a keyword cons of using var why did Java use var? - show generics example Gen/1/2/3