Record Class ForEachSlicePlan<T,C>
java.lang.Object
java.lang.Record
dev.engine_room.flywheel.lib.task.ForEachSlicePlan<T,C>
- Type Parameters:
T- The type of the list elements.C- The type of the context object.- Record Components:
listSupplier- A supplier of the list to iterate over.action- The action to perform on each sub list.
- All Implemented Interfaces:
Plan<C>,SimplyComposedPlan<C>
public record ForEachSlicePlan<T,C> (SupplierWithContext<C,List<T>> listSupplier, ConsumerWithContext<List<T>,C> action)
extends Record
implements SimplyComposedPlan<C>
A plan that executes code over many slices of a provided list.
The size of the slice is dynamically determined based on the number of available threads.
-
Constructor Summary
ConstructorsConstructorDescriptionForEachSlicePlan(SupplierWithContext<C, List<T>> listSupplier, ConsumerWithContext<List<T>, C> action) Creates an instance of aForEachSlicePlanrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.final booleanIndicates whether some other object is "equal to" this one.voidexecute(TaskExecutor taskExecutor, C context, Runnable onCompletion) Submit this plan for execution.final inthashCode()Returns a hash code value for this object.Returns the value of thelistSupplierrecord component.static <T,C> ForEachSlicePlan<T, C> of(SupplierWithContext.Ignored<C, List<T>> iterable, ConsumerWithContext.Ignored<List<T>, C> forEach) static <T,C> ForEachSlicePlan<T, C> of(SupplierWithContext.Ignored<C, List<T>> iterable, ConsumerWithContext<List<T>, C> forEach) static <T,C> ForEachSlicePlan<T, C> of(SupplierWithContext<C, List<T>> iterable, ConsumerWithContext.Ignored<List<T>, C> forEach) static <T,C> ForEachSlicePlan<T, C> of(SupplierWithContext<C, List<T>> iterable, ConsumerWithContext<List<T>, C> forEach) final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.engine_room.flywheel.lib.task.SimplyComposedPlan
and, then
-
Constructor Details
-
ForEachSlicePlan
public ForEachSlicePlan(SupplierWithContext<C, List<T>> listSupplier, ConsumerWithContext<List<T>, C> action) Creates an instance of aForEachSlicePlanrecord class.- Parameters:
listSupplier- the value for thelistSupplierrecord componentaction- the value for theactionrecord component
-
-
Method Details
-
of
public static <T,C> ForEachSlicePlan<T,C> of(SupplierWithContext<C, List<T>> iterable, ConsumerWithContext<List<T>, C> forEach) -
of
public static <T,C> ForEachSlicePlan<T,C> of(SupplierWithContext<C, List<T>> iterable, ConsumerWithContext.Ignored<List<T>, C> forEach) -
of
public static <T,C> ForEachSlicePlan<T,C> of(SupplierWithContext.Ignored<C, List<T>> iterable, ConsumerWithContext<List<T>, C> forEach) -
of
public static <T,C> ForEachSlicePlan<T,C> of(SupplierWithContext.Ignored<C, List<T>> iterable, ConsumerWithContext.Ignored<List<T>, C> forEach) -
execute
Description copied from interface:PlanSubmit this plan for execution.You must call
onCompletion.run()when the plan has completed execution. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
listSupplier
Returns the value of thelistSupplierrecord component.- Returns:
- the value of the
listSupplierrecord component
-
action
Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord component
-