Hacker News new | ask | show | jobs
by staticassertion 3429 days ago
Optional forces the null check (at the cost of a pointer dereference :( but that's Java for you). That's the difference.

It also provides some nice combinator syntax for handling that null beyond .isPresent, but if you were to just get .isPresent it would be a win.

Documentation is optional (hah) and therefor shouldn't be relied on.

Optional as a return type means there's no need to check for documentation, there's no need for @Nullable, and you get some pretty syntax to boot.