Hacker News new | ask | show | jobs
by village-idiot 3427 days ago
Here's how this works. If a function would not return null originally, you continue to return the original type and use Optional::map.

If a function could return either T or null, return Optional<T>, and then use Optional::flatMap to join them together.

Pretty straightforward.