Say I have the following code
data.stream()
.map(x -> {
Object a = maybeReturnsNull(x);
return a == null ? defaultValue : a;
})
Either is fine. Pick the one that seems more readable to you. If the calculation naturally decomposes, as this one does, then the multiple maps is probably more readable. Some calculations won't naturally decompose, in which case you're stuck at the former. In neither case should you be worrying that one is significantly more performant than the other; that's largely a non-consideration.
java has provided a dedicated API to handle with "null".
https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html