I personally don't have a problem with it, but if some find it hard to read,
then here's the same thing re-phrased:

#!{{{
boolean equal = true;

while (iterator.hasNext()
    && linkedListIterator.hasNext()) {
    if (!iterator.next().equals(linkedListIterator.next())) {
        equal = false;
        break;
    }
}

return equal;
}}}

I prefer the brevity of the former, but that may just be me :)

Cheers,
-T

On Tue, Sep 1, 2009 at 6:38 AM, Martijn Dashorst <[email protected]
> wrote:

> On Tue, Sep 1, 2009 at 11:41 AM, Noel Grandin<[email protected]>
> wrote:
> >
> > It's legal and technically correct Java, but I prefer to write such
> > things like this:
> >
> >   while (iterator.hasNext()) {}
> >
> > to make it obvious that it's an empty block.
> >
>
> And even better:
>
> while (iterator.hasNext()) { /* intentionally left blank */ }
>
> But this type of code does smell pretty awful and should be avoided in
> the first place.
>
> Martijn
>

Reply via email to