You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2008/03/19 07:54:24 UTC

[jira] Closed: (COLLECTIONS-111) IteratorChain skips over elements in iterator

     [ https://issues.apache.org/jira/browse/COLLECTIONS-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed COLLECTIONS-111.
-------------------------------------

    Resolution: Cannot Reproduce

As per my previous investigation, closing this as Cannot Reproduce.

> IteratorChain skips over elements in iterator
> ---------------------------------------------
>
>                 Key: COLLECTIONS-111
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-111
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Iterator
>    Affects Versions: 3.1
>         Environment: Operating System: Windows XP
> Platform: PC
>            Reporter: Jonathan Giles
>             Fix For: 3.3
>
>
> Hi there,
> When using the IteratorChain class to add multiple iterators, it appears that
> using itChain.hasNext() and itChain.next() skips a number of elements in the
> iterator at each step.
> Given a single iterator of 7 elements, and using the following code:
> private IteratorChain buildIterator() {
> // this iterator contains the children of the current object only
> Iterator it = getChildren(p);
> 		
> // we use an IteratorChain to add multiple iterators together without the
> overhead of copying
> IteratorChain itChain = new IteratorChain(it);
> return itChain;
> }
> and then simply
> IteratorChain it = treeModel.getAllTreeNodes(obj);
> 	
> // FIXME this only prints one or two of the results, which is a bug!
> while (it.hasNext())
>     System.out.println(": " + it.next().getClass());
> I put in 7 elements, but only get 2 out - the 2nd and the last elements. It
> appears that through my debugging that the nextClause variable is updated even
> when the hasNext() function is called.
> Also, if I put 7 system.out.println statements, all elements are printed as normal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.