5 ms·
An alternative I've used or seen used in Java is to put @Nullable on the function. The caller knows the result could be null, and must check for it. Linters/Sta
by yellow_lead 3y ago
An alternative I've used or seen used in Java is to put @Nullable on the function. The caller knows the result could be null, and must check for it. Linters/Static analysis can verify when you haven't checked it as well.
There's an urge to return Optional<Object> but now you must check Optional.isPresent AND object != null.