mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix
This commit is contained in:
@@ -1964,19 +1964,6 @@ public class CollUtil {
|
||||
return IterUtil.getFirst(iterable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取集合的第一个元素
|
||||
*
|
||||
* @param <T> 集合元素类型
|
||||
* @param iterator {@link Iterator}
|
||||
* @return 第一个元素
|
||||
* @see IterUtil#getFirst(Iterator)
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public static <T> T getFirst(final Iterator<T> iterator) {
|
||||
return IterUtil.getFirst(iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取集合的最后一个元素
|
||||
*
|
||||
|
@@ -556,6 +556,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--;
|
||||
|
Reference in New Issue
Block a user