Class FastCursorLoops
java.lang.Object
net.imglib2.loops.FastCursorLoops
A package-private utility class that's used by
LoopBuilder.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LongConsumercreateLoop(Object action, List<? extends Cursor<?>> cursors) For example.: Given a BiConsumer and two Cursors:
-
Field Details
-
factories
-
-
Constructor Details
-
FastCursorLoops
private FastCursorLoops()
-
-
Method Details
-
createLoop
For example.: Given a BiConsumer and two Cursors:
This methodBiConsumer<A, B> biConsumer = ... ; Cursor<A> cursorA = ... ; Cursor<B> cursorB = ... ;createLoop(biConsumer, Arrays.asList(cursorA, cursorB))will return a LongConsumer that is functionally equivalent to:
The returnedLongConsumer loop = n -> { for ( long i = 0; i < n; i++ ) biConsumer.accept( cursorA.next(), cursorB.next() ); };LongConsumeris created in a way, that it can be gracefully optimised by the Java just-in-time compiler.- Parameters:
action- This must be an instance ofConsumer,BiConsumer,LoopBuilder.TriConsumer,LoopBuilder.FourConsumer,LoopBuilder.FiveConsumerorLoopBuilder.SixConsumer.cursors- A list ofCursor, the size of the list must fit given action.- Throws:
IllegalArgumentException- if the number of cursor does not fit the given consumer.
-