I know that when I read the answer to this I will see that I have overlooked something that was under my eyes. But I have spent the last 30 minutes trying to figure it out m
Guava has a pretty elegant solution for this using MoreObjects.firstNonNull:
Integer someNullInt = null; int myInt = MoreObjects.firstNonNull(someNullInt, 0);