The Java Optional class was introduced in Java 8 in order to help stop the propagation of null being returned to client facing methods.
The problem is that everyone started using it everywhere they say null. This caused confusion, un-necessary overhead and left everyone scratching their heads.
Does the Java Optional Class finally rid us of NullPointerExceptions? I’ll demonstrate how when Optional is used correctly and when combined with Java’s functional style of programming, that this is indeed possible.
In this tutorial (Part 1) we'll approach Java Optional with a Problem/Solution approach and then cover...
how to create and retrieve an Optional value
Where is the best place to use Java Optional (recommendation)
Introduction to pitfalls and how to use Java Optional with an
Imperative style of programming via Optional methods isPresent
and get
Introduction to Functional Style via Optional methods map,
ifPresent and ifPresentOrElse
You can see Part 2 of "Java Optional, NullPointerException Killer?" here ...
• Java Optional, NullPointerException K...
The Source code is available onGitHub at https://github.com/mvpjava/java-optio...
I've also written a blog post ..
"Optional, NullPointerException Killer?"
which covers other aspects on the Java Optional Class.
Check it out here ...
http://mvpjava.com/java-optional/
======================================================
Follow me ...
Website: http://www.mvpjava.com
Facebook: / mvpjava
Twitter : / mvpjava
GitHub : https://github.com/mvpjava
Subscribe to MVP Java ...
https://www.youtube.com/c/MVPJava?sub...
Auf dieser Seite können Sie das Online-Video Java Optional, NullPointerException Killer? Part 1 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer MVP Java 15 Februar 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,657 Mal angesehen und es wurde von 138 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!