code: public static <T extends Collection<?>> T validIndex(final T collection, final int index, final String message, final Object... values) {
          Validate.notNull(collection);
          if (index < 0 || index >= collection.size()) {
              throw new IndexOutOfBoundsException(StringUtils.simpleFormat(message, values));
          }
          return collection;
      }
docs: <p>Validates that the index is within the bounds of the argument
  collection; otherwise throwing an exception with the specified message.</p>
  
  <pre>Validate.validIndex(myCollection, 2, "The collection index is invalid: ");</pre>
  
  <p>If the collection is {@code null}, then the message of the
  exception is &quot;The validated object is null&quot;.</p>
  
  @param <T> the collection type
  @param collection  the collection to check, validated not null by this method
  @param index  the index to check
  @param message  the {@link String#format(String, Object...)} exception message if invalid, not null
  @param values  the optional values for the formatted exception message, null array not recommended
  @return the validated collection (never {@code null} for chaining)
  @throws NullPointerException if the collection is {@code null}
  @throws IndexOutOfBoundsException if the index is invalid
  @see #validIndex(Collection, int)
  
  @since 3.0