code: public static <T> T check(T reference, Predicate<T> predicate,
                                @Nullable String errorMessageTemplate,
                                @Nullable Object... errorMessageArgs) {
          checkArgument(reference != null, "Expected non-null reference");
          checkArgument(predicate != null, "Expected non-null predicate");
          checkArgument(predicate.apply(reference), messageFromNullable(errorMessageTemplate, errorMessageArgs));
          return reference;
      }
docs: Performs check with the predicate.
  
  @param reference            reference to check
  @param predicate            the predicate to use
  @param errorMessageTemplate a template for the exception message should the
  check fail. The message is formed by replacing each {@code %s}
  placeholder in the template with an argument. These are matched by
  position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
  Unmatched arguments will be appended to the formatted message in square
  braces. Unmatched placeholders will be left as-is.
  @param errorMessageArgs     the arguments to be substituted into the message
  template. Arguments are converted to strings using
  {@link String#valueOf(Object)}.
  @param <T>                  the reference type
  @return the original reference
  @throws IllegalArgumentException if the {@code reference} or {@code predicate} is null
  @throws IllegalArgumentException if the {@code reference} doesn't match provided predicate