public final class FastCursorLoops extends Object
LoopBuilder
.createLoop(Object, List)
Modifier and Type | Class and Description |
---|---|
static class |
FastCursorLoops.FiveCursorLoop<A,B,C,D,E> |
static class |
FastCursorLoops.FourCursorLoop<A,B,C,D> |
static class |
FastCursorLoops.OneCursorLoop<A> |
static class |
FastCursorLoops.SixCursorLoop<A,B,C,D,E,F> |
static class |
FastCursorLoops.ThreeCursorLoop<A,B,C> |
static class |
FastCursorLoops.TwoCursorLoop<A,B> |
Modifier and Type | Method and Description |
---|---|
static LongConsumer |
createLoop(Object action,
List<? extends Cursor<?>> cursors)
For example.: Given a BiConsumer and two Cursors:
|
public static LongConsumer createLoop(Object action, List<? extends Cursor<?>> cursors)
BiConsumer<A, B> biConsumer = ... ;
Cursor<A> cursorA = ... ;
Cursor<B> cursorB = ... ;
This method
createLoop(biConsumer, Arrays.asList(cursorA, cursorB))
will return a LongConsumer that is functionally equivalent to:
LongConsumer loop = n -> {
for ( long i = 0; i < n; i++ )
biConsumer.accept( cursorA.next(), cursorB.next() );
};
The returned LongConsumer
is created in a way, that it can be
gracefully optimised by the Java just-in-time compiler.action
- This must be an instance of Consumer
,
BiConsumer
, LoopBuilder.TriConsumer
, LoopBuilder.FourConsumer
,
LoopBuilder.FiveConsumer
or LoopBuilder.SixConsumer
.cursors
- A list of Cursor
, the size of the list must fit
given action.IllegalArgumentException
- if the number of cursor does not fit the given consumer.Copyright © 2015–2022 ImgLib2. All rights reserved.