[ImageJ-devel] Simplifying loops?
Johannes Schindelin
Johannes.Schindelin at gmx.de
Mon Jun 14 11:54:22 CDT 2010
Hi,
On Mon, 14 Jun 2010, Stephan Preibisch wrote:
> This is definitely something we could do as far as the linked iterators
> work. Right now we did not do that because it is quite often extra work,
> e.g. if you copy an image you need only one check instead of two:
>
> cursor1, cursor2;
>
> while ( cursor1.hasNext() )
> {
> cursor1.fwd();
> cursor2.fwd();
> // meat of the loop
> }
Ah, I see. Maybe just a shortcut
public boolean next() {
if (!hasNext())
return false;
fwd();
return true;
}
to optimize for the common case?
Ciao,
Dscho
More information about the ImageJ-devel
mailing list