2 ms·
Java Optional is not a general replacement for nulls (although people might use it this way). It's a way to replace nulls in method return value, when those nul
by vbezhenar 5y ago
Java Optional is not a general replacement for nulls (although people might use it this way). It's a way to replace nulls in method return value, when those nulls indicate missing value. It's a subtle philosophical distinction, but I think that it's worth to remember it.
If you want to improve nulls handling in Java, you should use @NotNull annotation and corresponding linters.
https://stackoverflow.com/a/26328555/315129 https://stackoverflow.com/a/26328555/315129