This commit is contained in:
Looly
2022-06-08 16:02:11 +08:00
parent 551e6fc7b8
commit 1d10e758f4
2 changed files with 5 additions and 1 deletions

View File

@@ -553,6 +553,9 @@ public class IterUtil {
* @since 5.8.0
*/
public static <E> E get(final Iterator<E> iterator, int index) throws IndexOutOfBoundsException {
if(null == iterator){
return null;
}
Assert.isTrue(index >= 0, "[index] must be >= 0");
while (iterator.hasNext()) {
index--;