[SOLVED]: Returning Optionals in Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 15

[SOLVED]: Returning Optionals in Java

When would it be a good idea to return an Optional? Would greatly appreciate if anyone could illustrate this with a nice, practical example. Thanks.

15th Nov 2020, 7:41 AM
Chris Ng
Chris Ng - avatar
2 Answers
+ 8
Hi Ipang, Thanks for your advice. I have added Java as the programming language of choice, to improve the clarity of my question. Chris
15th Nov 2020, 8:01 AM
Chris Ng
Chris Ng - avatar
+ 7
Hi Coder Kitten, Another brilliant answer! Thanks, Chris
15th Nov 2020, 11:12 PM
Chris Ng
Chris Ng - avatar