Java Optional, NullPointerException Killer? Part 1

Publicado el: 15 febrero 2019
en el canal de: MVP Java
5,657
138

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...


En esta página del sitio puede ver el video en línea Java Optional, NullPointerException Killer? Part 1 de Duración hora minuto segunda en buena calidad , que subió el usuario MVP Java 15 febrero 2019, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 5,657 veces y le gustó 138 a los espectadores. Disfruta viendo!