Not to defend Java, but some examples seem just unfair:
if (nullableVariable != null) {
boolean success = nullableVariable.someMethodCall()
if (success) {
return success
} else {
return fallbackIfNullMethodCall()
}
} else {
return fallbackIfNullMethodCall()
}
// Wouldn't that work just as well ?
if (nullableVariable != null) {
return nullableVariable.someMethodCall() || fallbackIfNullMethodCall();
}
return fallbackIfNullMethodCall();
Ok, that is still more cluter than the kotlin elvis operator, but more fair, isn't it?