This commit is contained in:
Gary Gregory 2018-01-12 11:03:43 -07:00
parent 22daa5f1dd
commit 1e6435ec10
2 changed files with 11 additions and 4 deletions

View File

@ -775,10 +775,14 @@ public class IterableUtils {
} }
/** /**
* Shortcut for {@code get(iterator, 0)}.
* <p>
* Returns the <code>first</code> value in the <code>iterable</code>'s {@link Iterator}, throwing * Returns the <code>first</code> value in the <code>iterable</code>'s {@link Iterator}, throwing
* <code>IndexOutOfBoundsException</code> if there is no such element. * <code>IndexOutOfBoundsException</code> if there is no such element.
* </p>
* <p> * <p>
* If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}. * If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}.
* </p>
* *
* @param <T> the type of object in the {@link Iterable}. * @param <T> the type of object in the {@link Iterable}.
* @param iterable the {@link Iterable} to get a value from, may be null * @param iterable the {@link Iterable} to get a value from, may be null

View File

@ -1413,14 +1413,17 @@ public class IteratorUtils {
} }
/** /**
* Shortcut for {@code get(iterator, 0)}.
* <p>
* Returns the <code>first</code> value in {@link Iterator}, throwing * Returns the <code>first</code> value in {@link Iterator}, throwing
* <code>IndexOutOfBoundsException</code> if there is no such element. * <code>IndexOutOfBoundsException</code> if there is no such element.
* </p>
* <p> * <p>
* The Iterator is advanced to <code>index</code> (or to the end, if * The Iterator is advanced to <code>0</code> (or to the end, if
* <code>index</code> exceeds the number of entries) as a side effect of this method. * <code>0</code> exceeds the number of entries) as a side effect of this method.
* * </p>
* @param <E> the type of object in the {@link Iterator} * @param <E> the type of object in the {@link Iterator}
* @param iterator the iterator to get a value from * @param iterator the iterator to get a value from
* @return the first object * @return the first object
* @throws IndexOutOfBoundsException if the request is invalid * @throws IndexOutOfBoundsException if the request is invalid
* @since 4.2 * @since 4.2