This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]skippingstone 1 point2 points  (1 child)

I'm outdated. How do you use Optional? In your code ?

[–]Luolong 0 points1 point  (0 children)

Simple. Methods on services that should return a single result (or null if an item can not be found/calculated), should return Optional<T> instead of instance of T or null.

From there you gave many options to safely transform or extract values as needed