public class CollectionRunner<E> extends Object
This more or less duplicates part of the behaviour of the Java 8
streams framework, but it provides the additional control available
from SplitProcessor, and also works with a
ProgressIndicator to provide interruption control
and progress logging.
| Modifier and Type | Class and Description |
|---|---|
static interface |
CollectionRunner.ElementCollector<E,A>
Interface to define a collection operation for use with this class.
|
| Modifier and Type | Field and Description |
|---|---|
static CollectionRunner<?> |
DFLT
Untyped instance using default policy.
|
static CollectionRunner<?> |
SEQUENTIAL
Untyped instance for sequential operation.
|
| Constructor and Description |
|---|
CollectionRunner()
Default constructor, using default policy.
|
CollectionRunner(SplitProcessor<?> processor)
Constructs an instance with a given SplitProcessor.
|
| Modifier and Type | Method and Description |
|---|---|
<A> A |
collect(CollectionRunner.ElementCollector<E,A> collector,
Collection<E> collection)
Performs a collect operation without logging.
|
<A> A |
collect(CollectionRunner.ElementCollector<E,A> collector,
Collection<E> collection,
ProgressIndicator progger)
Performs a collect operation with optional progress logging.
|
static <E,A> A |
collectStream(CollectionRunner.ElementCollector<E,A> collector,
java.util.stream.Stream<E> stream)
Performs a collection operation using the Java 8 streams framework.
|
SplitProcessor<?> |
getSplitProcessor()
Returns this runner's SplitProcessor.
|
public static final CollectionRunner<?> SEQUENTIAL
public static final CollectionRunner<?> DFLT
public CollectionRunner()
public CollectionRunner(SplitProcessor<?> processor)
processor - controls behaviourpublic SplitProcessor<?> getSplitProcessor()
public <A> A collect(CollectionRunner.ElementCollector<E,A> collector, Collection<E> collection)
collector - defines behaviourcollection - data on which to operatepublic <A> A collect(CollectionRunner.ElementCollector<E,A> collector, Collection<E> collection, ProgressIndicator progger)
collector - defines behaviourcollection - data on which to operateprogger - progress loggerpublic static <E,A> A collectStream(CollectionRunner.ElementCollector<E,A> collector, java.util.stream.Stream<E> stream)
Collector
based on the supplied ElementCollector and feeds the
stream to it.
This method is only intended for testing and comparison purposes; if you actually want to use Java 8 streams, you might as well use the Collector interface directly.
collector - collectorstream - input streamCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.