Package lumis.util
Class CollectionExecutor<T>
- java.lang.Object
-
- lumis.util.CollectionExecutor<T>
-
- Type Parameters:
T
- the type of the collection elements.
public class CollectionExecutor<T> extends java.lang.Object
Utility used to process collections in blocks.Currently each block is fixed in a maximum size, the default value is 1000 elements.
- Since:
- 4.2.2.090330
- Version:
- $Revision$ $Date$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CollectionExecutor.IIterationCommand<T>
Interface that is implemented to provide the command for executing a block of a collection.
-
Constructor Summary
Constructors Constructor Description CollectionExecutor(java.util.Collection<? extends T> items)
Creates a new executor.CollectionExecutor(java.util.Collection<? extends T> items, int iterationBlock)
Creates a new executor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> void
execute(java.util.Collection<T> collection, CollectionExecutor.IIterationCommand<T> command)
Executes a command on the collection.void
execute(CollectionExecutor.IIterationCommand<T> command)
Executes a command on the collection in this executor.
-
-
-
Constructor Detail
-
CollectionExecutor
public CollectionExecutor(java.util.Collection<? extends T> items)
Creates a new executor.- Parameters:
items
- the collection to be processed in blocks.- Since:
- 4.2.2.090330
-
CollectionExecutor
public CollectionExecutor(java.util.Collection<? extends T> items, int iterationBlock)
Creates a new executor.- Parameters:
items
- the collection to be processed in blocks.iterationBlock
- the maximum number of element in each iteration that callsCollectionExecutor.IIterationCommand.execute(List)
.- Since:
- 12.3.0
-
-
Method Detail
-
execute
public void execute(CollectionExecutor.IIterationCommand<T> command) throws PortalException
Executes a command on the collection in this executor.CollectionExecutor.IIterationCommand.execute(List)
is called multiple times, given as argument a sublist of the collection in this executor, in the same order as the collection's iterator.- Parameters:
command
- the command to be executed.- Throws:
PortalException
- Since:
- 4.2.2.090330
-
execute
public static <T> void execute(java.util.Collection<T> collection, CollectionExecutor.IIterationCommand<T> command) throws PortalException
Executes a command on the collection.CollectionExecutor.IIterationCommand.execute(List)
is called multiple times, given as argument a sublist of the collection in this executor, in the same order as the collection's iterator.- Parameters:
collection
- the collection to be processed in blocks.command
- the command to be executed.- Throws:
PortalException
- Since:
- 10.0.0
-
-