|
|
|
|
|
by mbizzle88
3706 days ago
|
|
> And if “usable” has any additional meaning besides “is not null”, this entire machinery is useless because one STILL has to figure out the state of the data! That's inaccurate. In fact Optional makes this situation (having to check if data is not null and valid) even easier, because you can simply filter/map the value without having to first check that it is non-null. For example: possibleResult.filter(res -> isValid(res))
.ifPresent(res -> doSomething(res));
|
|