commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [collections] bug in IteratorChain?
Date Tue, 02 Dec 2003 00:34:05 GMT
I have a vague memory of something like this getting fixed once upon a time.
Are you testing against the CVS version of this file or a release?

Stephen

----- Original Message -----
From: "Kevin O'Neill" <kevin@rocketred.com.au>
To: <commons-user@jakarta.apache.org>
Sent: Tuesday, December 02, 2003 12:25 AM
Subject: Re: [collections] bug in IteratorChain?


> 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: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message