With Java 8:
if (Optional.ofNullable(myInteger).orElse(0) != 0) {
...
}
Note that Optional
may help you to completely avoid the if condition at all, depending on your use case…
With Java 8:
if (Optional.ofNullable(myInteger).orElse(0) != 0) {
...
}
Note that Optional
may help you to completely avoid the if condition at all, depending on your use case…