Java - Optional Class Tutorial with Example

Published: 19 April 2020
on channel: Akhil Karun
1,425
27

Notes on how to use the Optional class in Java
https://www.oracle.com/technical-reso...

0:00 Introduction
0:17 Goodbye null checks!
0:56 Replacing null check with Optional
1:45 With Optional Lambdas
2:37 Another Example
5:07 When not to use Optional?
6:14 When to use Optional? - THUMB RULE
7:12 Summary Time

Key Ideas:
It is a class that encapsulates an optional value. You can also create classes using Optional.of(usb);
Wrap classes with Optional.
This wrapping unlocks streams functionality.
Use ifPresent instead of isPresent.


Oracle article link:
https://www.oracle.com/technical-reso...


On this page of the site you can watch the video online Java - Optional Class Tutorial with Example with a duration of hours minute second in good quality, which was uploaded by the user Akhil Karun 19 April 2020, share the link with friends and acquaintances, this video has already been watched 1,425 times on youtube and it was liked by 27 viewers. Enjoy your viewing!