Class ArrayIterator<E>
java.lang.Object
org.miaixz.bus.core.center.iterator.ArrayIterator<E>
- Type Parameters:
E- 元素类型
- All Implemented Interfaces:
Serializable,Iterable<E>,Iterator<E>,IterableIterator<E>,ResettableIterator<E>
public class ArrayIterator<E>
extends Object
implements IterableIterator<E>, ResettableIterator<E>, Serializable
数组Iterator对象
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionArrayIterator(E[] array) 构造ArrayIterator(Object array) 构造ArrayIterator(Object array, int startIndex) 构造ArrayIterator(Object array, int startIndex, int endIndex) 构造 -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.miaixz.bus.core.center.iterator.IterableIterator
iteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ArrayIterator
构造- Parameters:
array- 数组- Throws:
IllegalArgumentException- array对象不为数组抛出此异常NullPointerException- array对象为null
-
ArrayIterator
构造- Parameters:
array- 数组- Throws:
IllegalArgumentException- array对象不为数组抛出此异常NullPointerException- array对象为null
-
ArrayIterator
构造- Parameters:
array- 数组startIndex- 起始位置,当起始位置小于0或者大于结束位置,置为0。- Throws:
IllegalArgumentException- array对象不为数组抛出此异常NullPointerException- array对象为null
-
ArrayIterator
构造- Parameters:
array- 数组startIndex- 起始位置,当起始位置小于0或者大于结束位置,置为0。endIndex- 结束位置,当结束位置小于0或者大于数组长度,置为数组长度。- Throws:
IllegalArgumentException- array对象不为数组抛出此异常NullPointerException- array对象为null
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove()不允许操作数组元素- Specified by:
removein interfaceIterator<E>- Throws:
UnsupportedOperationException- always
-
getArray
获得原始数组对象- Returns:
- 原始数组对象
-
reset
public void reset()重置数组位置- Specified by:
resetin interfaceResettableIterator<E>
-