Another one to watch for: Optional.of. It's easy to assume that the behavior of this method when passed null will be to return an empty Optional. Instead, it throws a NullPointerException.
The more verbose Optional.ofNullable is the one that returns an empty Optional when passed null.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Another one to watch for: Optional.of. It's easy to assume that the behavior of this method when passed
null
will be to return an empty Optional. Instead, it throws a NullPointerException.The more verbose Optional.ofNullable is the one that returns an empty Optional when passed
null
.