[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how should Chain.iterator(n,n-1) work?



Ondrej LHOTAK <olhotak@sable.mcgill.ca> wrote:
> > I'm not sure this is really a "special" case except that it's been
> > happening fairly often -- as a consequence of confusion involving the
> > use and meaning of Trap.getEndUnit().
> 
> The reason I say it's a special case is that it's the only way to
> iterate over an empty list of statements.

That's not necessarily a problem given the documentation:

    /** Returns an iterator over this Chain, starting at head and reaching tail
(inclusive). */
    public Iterator iterator(Object head, Object tail);

From that one would expect that at least the head is included.  If we
include the above special case, then more explanation (making the
caveats explicit) is needed for this call.

Cheers,
Navin.