18 ms·
The point is that returning an Optional gives you nothing above returning a null - in fact it increases complexity and makes calling code more error-prone for n
by saltedmd5 9y ago
The point is that returning an Optional gives you nothing above returning a null - in fact it increases complexity and makes calling code more error-prone for no gain.
If your contract says you return a Foo, you could be returning a null. If you change that to Optional<Foo> you could still be returning a null.
It's not what Optionals are for. They are just widely misunderstood and abused.