On 7/13/2014 3:19 AM, Peter Henderson wrote:
... For null checking I'd prefer if the api changed so that nullable arguments are replaced with an Optional<value>.
We've been experimenting using Java 8's Optional<> in our project, and we have mixed feelings. It may be useful in some circumstances, but our tentative opinion is that not quite a panacea. And if you don't propagate its use throughout the framework, its benefit is diminished, because you have to keep converting back and forth between nullable and Optional<> paradigms.
But even accepting the value of Optional<>, its use won't obviate the need for null checking, as we'll need to check the Optional<> instances themselves for null before storing them for later. So we'll still need something like Guava's Preconditions.checkNotNull().
Garret