On Mon, 01 Dec 2003 17:46:14 +0000, pwomack wrote:
> The following pseudo Junit:
>
> Integer a = new Integer(3);
> Integer b = new Integer(7);
>
> ArrayList empty = new ArrayList();
> IteratorChain ic = new IteratorChain();
> ic.addIterator(empty.iterator());
> ic.addIterator(new SingletonIterator(a)); ic.addIterator(new
> SingletonIterator(b));
>
> int tot = 0;
> for(;ic.hasNext();) {
> Integer anInt = (Integer)ic.next();
> tot += anInt.intValue();
> }
> assertEquals(10, tot);
>
> Fails. tot is actually 0.
>
> I suspect the empty first Iterator somehow makes the whole iteratorChain
> behave as if it's empty.
I've encountered this myself and it was to do with the first
iterator being empty.
-k.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]