public static <T extends Collection<?>> T validIndex(final T collection, final int index) {
        return validIndex(collection, index, DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE, Integer.valueOf(index));
    }
<p>Validates that the index is within the bounds of the argument
collection; otherwise throwing an exception.</p>

<pre>Validate.validIndex(myCollection, 2);</pre>

<p>If the index is invalid, then the message of the exception
is &quot;The validated collection index is invalid: &quot;
followed by the index.</p>

@param <T> the collection type
@param collection  the collection to check, validated not null by this method
@param index  the index to check
@return the validated collection (never {@code null} for method chaining)
@throws NullPointerException if the collection is {@code null}
@throws IndexOutOfBoundsException if the index is invalid
@see #validIndex(Collection, int, String, Object...)

@since 3.0
replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/Validate.java