code: public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) {
          if (obj == null)
              throw new NullPointerException(messageSupplier.get());
          return obj;
      }
docs: Checks that the specified object reference is not {@code null} and
  throws a customized {@link NullPointerException} if it is.
  
  <p>Unlike the method {@link #requireNonNull(Object, String)},
  this method allows creation of the message to be deferred until
  after the null check is made. While this may confer a
  performance advantage in the non-null case, when deciding to
  call this method care should be taken that the costs of
  creating the message supplier are less than the cost of just
  creating the string message directly.
  
  @param obj     the object reference to check for nullity
  @param messageSupplier supplier of the detail message to be
  used in the event that a {@code NullPointerException} is thrown
  @param <T> the type of the reference
  @return {@code obj} if not {@code null}
  @throws NullPointerException if {@code obj} is {@code null}
  @since 1.8