#What do you prefer?
1 messages · Page 1 of 1 (latest)
those two arent doing the same
also, Optional is meant to be used as return type by methods that want to indicate absence of a result
any other use of Optional is technically abuse
so what ur likely trying to do here is unintended use of the class
go for whatever is more readable, that's the number one goal 🙂
As Zabuzard pointed out those don't do the same, isPresent would be a closer match.
And if you're explicitly wanting an empty Optional, ask for it with Optional.empty()