31 How To Use Java 8 Optional Class?

Published: 27 January 2022
on channel: coderolls
24
0

#Java8Features #Optional

Example code can be found here: https://github.com/coderolls/java-8-f...

In this video, we will see the Optional class. The Optional class was introduced in Java 8.

Java 8 Optional class helps us deal with the NullPointerException in a better way.

In our day-to-day java programming, we use the if statement to do the null checks for the variable. But doing null checks using the if-else every single time is a tedious job to do. And as per the human tendency, there are great chances to forget to perform the null checks, which make our code error-prone.

To handle these situations, we got the Optional class in Java 8.

methods such as .ofNullable(), isPresent(), get(), orElse() helps us to deal with NullPointerException.

Watch this video to learn more about Java 8 Optional Class with some examples.

This video is part of Java 8 features full course. ▶️    • 01 How To Write Lambda Expressions In...  

GitHub Repository Link: https://github.com/coderolls/java-8-f...

00:00 Introduction To Optional Class
01:19 How To Use Optional Class in Java?

Buy me a coffee ☕: https://www.buymeacoffee.com/gauravku...

This is video is uploaded by codeRolls. Visit us at https://coderolls.com

Subscribe to my YouTube Channel
   / @coderolls  

Follow us on:

Twitter ►   / coderolls  
Facebook ►   / coderolls  
Instagram ►   / coderolls  
Pinterest ►   / coderolls  


Watch video 31 How To Use Java 8 Optional Class? online without registration, duration hours minute second in high quality. This video was added by user coderolls 27 January 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2 once and liked it people.