org.rhq.enterprise.server.util
Class BatchIterator<T>
java.lang.Object
org.rhq.enterprise.server.util.BatchIterator<T>
- All Implemented Interfaces:
- Iterable<List<T>>
public class BatchIterator<T>
- extends Object
- implements Iterable<List<T>>
A convenience class for getting around the http://ora-01795.ora-code.com/ issue, which limits the size of the
in-clause parameters to 1000. Can be used to take a large collection of ids, and iterate over them in batches.
The default batch size using the single-argument constructor is 1000, but the constructor which takes two arguments
allows overriding the batch size to any positive integer.
- Author:
- Joseph Marques, John Sanda
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
BatchIterator
public BatchIterator(List<T> data)
BatchIterator
public BatchIterator(List<T> data,
int batchSize)
iterator
public Iterator<List<T>> iterator()
- Specified by:
iterator in interface Iterable<List<T>>
hasMoreBatches
public boolean hasMoreBatches()
getNextBatch
public List<T> getNextBatch()
Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.