public static T checkNotNull()

in hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/Preconditions.java [105:122]


  public static <T> T checkNotNull(final T obj, final String message,
      final Object... values) {
    // Deferring the evaluation of the message is a tradeoff between the cost
    // of constructing lambda Vs constructing a string object.
    // Using lambda would allocate an object on every call:
    //       return checkNotNull(obj, () -> String.format(message, values));
    if (obj == null) {
      String msg;
      try {
        msg = String.format(message, values);
      } catch (Exception e) {
        LOG.debug("Error formatting message", e);
        msg = VALIDATE_IS_NOT_NULL_EX_MESSAGE;
      }
      throw new NullPointerException(msg);
    }
    return obj;
  }