5 ms·
There are multiple ways to represent an optional value, for example: 1) an empty list/array 2) throw an exception if the return value is missing. 3) -1 Option
by haglin 4y ago
There are multiple ways to represent an optional value, for example:
1) an empty list/array
2) throw an exception if the return value is missing.
3) -1
Optional can be used as a better alternative in all these cases. It's not just null.