Hacker News new | ask | show | jobs
by arnvidr 2369 days ago
Even that seems way too much. The original would be much easier as:

  if (nullableVariable != null) {
      boolean success = nullableVariable.someMethodCall()
      if (success) {
          return success;
      }
  }
  return fallbackIfNullMethodCall();
And even that can be more concise if you prefer:

  if (nullableVariable != null && nullableVariable.someMethodCall()) {
      return true;
  }
  return fallbackIfNullMethodCall();