Package org.aoju.bus.core.collection
Class PartitionIterator<T>
java.lang.Object
org.aoju.bus.core.collection.PartitionIterator<T>
- Type Parameters:
T- 字段类型
- All Implemented Interfaces:
Serializable,Iterable<List<T>>,Iterator<List<T>>,IterableIterator<List<T>>
分批迭代工具,可以分批处理数据
- 比如调用其他客户的接口,传入的入参有限,需要分批
- 比如mysql/oracle用in语句查询,超过1000可以分批
- 比如数据库取出游标,可以把游标里的数据一批一批处理
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription被分批的迭代器protected final int实际每批大小 -
Constructor Summary
Constructors -
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.aoju.bus.core.collection.IterableIterator
iteratorMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
iterator
被分批的迭代器 -
partitionSize
protected final int partitionSize实际每批大小
-
-
Constructor Details
-
PartitionIterator
创建分组对象- Parameters:
iterator- 迭代器partitionSize- 每批大小,最后一批不满一批算一批
-
-
Method Details