2 ms·
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 retu
by village-idiot 10y 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.