Class IteratorChain<T>
java.lang.Object
org.miaixz.bus.core.center.iterator.IteratorChain<T>
- Type Parameters:
T- 元素类型
public class IteratorChain<T>
extends Object
implements Iterator<T>, Chain<Iterator<T>,IteratorChain<T>>
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescription所有的Iteratorprotected int当前位置 -
Constructor Summary
ConstructorsConstructorDescription构造 可以使用addChain(Iterator)方法加入更多的集合。IteratorChain(Iterator<T>... iterators) 构造 -
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 java.util.Iterator
forEachRemaining
-
Field Details
-
allIterators
所有的Iterator -
currentIter
protected int currentIter当前位置
-
-
Constructor Details
-
IteratorChain
public IteratorChain()构造 可以使用addChain(Iterator)方法加入更多的集合。 -
IteratorChain
构造- Parameters:
iterators- 多个Iterator- Throws:
IllegalArgumentException- 当存在重复的迭代器,或添加的迭代器中存在null时抛出
-
-
Method Details
-
addChain
添加迭代器- Specified by:
addChainin interfaceChain<Iterator<T>,IteratorChain<T>> - Parameters:
iterator- 迭代器- Returns:
- 当前实例
- Throws:
IllegalArgumentException- 当迭代器被重复添加,或待添加的迭代器为null时抛出
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
iterator
-