public static final class XIterable.Executor<E> extends Object implements XIterable<E>
XIterable to wrap a subject of type E that procedures shall be
executed on.
By using an executor instance, an instance not implementing XIterable can be passed to a context
expecting an XIterable instance. Through this abstraction, logic can be written that can be
equally executed on single objects (via this wrapper) or multiple objects (via X-collections).
Example:
someRegistryLogic.register(persons); someRegistryLogic.register(new Exector<Person>(singlePerson));
XIterable.Executor<E>| Modifier and Type | Method and Description |
|---|---|
<P extends Consumer<? super E>> |
iterate(P procedure)
Executes the given procedure for each element of the
XIterable
until all elements have been processed or the action throws an
exception. |
public Executor(E subject)
public <P extends Consumer<? super E>> P iterate(P procedure)
XIterableXIterable
until all elements have been processed or the action throws an
exception. Unless otherwise specified by the implementing class,
procedures are performed in the order of iteration (if an iteration order
is specified). Exceptions thrown by the procedure are relayed to the
caller.Iterable.forEach(Consumer).Copyright © 2022 MicroStream Software. All rights reserved.