You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/12/03 06:11:36 UTC

DO NOT REPLY [Bug 25154] New: - IteratorChain bug with empty iterators.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25154>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25154

IteratorChain bug with empty iterators.

           Summary: IteratorChain bug with empty iterators.
           Product: Commons
           Version: 2.1 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Collections
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: andrus-jk@objectstyle.org


Haven't tried this with nightly builds, but 2.1 collections have the follwoing
problem: when the first iterator in a chain is empty, first call to "hasNext"
returns false, on second and subsequent calls, "true" is returned again as it
should. Here is an example:

        List emptyList = new ArrayList();
        List nonEmptyList = new ArrayList();
        nonEmptyList.add(new Object());
        
        IteratorChain it = new IteratorChain(new Iterator[]
{emptyList.iterator(), nonEmptyList.iterator()});
        System.out.println("Next? " + it.hasNext()); // prints false
        System.out.println("Next again? " + it.hasNext()); // prints true

Cheers,
Andrus

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