code: @VisibleForTesting
    protected static <T> List<T> validateArgument(List<T> list, Predicate<T> predicate,
                                                  Function<T, String> msgFn) {
  
      final Optional<T> firstInvalid = list.stream()
          .filter(predicate.negate())
          .findAny();
  
      if (firstInvalid.isPresent()) {
        throw new IllegalArgumentException(firstInvalid.map(msgFn).get());
      }
      return list;
    }
docs: Verifies that all entries in the Collection satisfy the predicate. If any do not, throw an
  IllegalArgumentException with the specified message for the first invalid entry.