[jdom-interest] another Iterator/ListIterator problem
Jason Hunter
jhunter at acm.org
Tue Jun 25 09:59:22 PDT 2002
I've not seen this before. Can you send a simple reproducible test case
(runnable program with an xml file)?
-jh-
Jens.Steiner at epost.de wrote:
>
> I have some problems with the Iterator i get with ListXY.iterator()
> Given the following code, hasNext() seems to return true even if no next element exists. Thus the while goes into another loop and
> a null pointer exeption is thrown. The ehas.size() returns 1 but the while loop runs >=1 times. I use iterators this way every day. I
> have no idea, what the reason for this behaviour could be. Changing to ListIterator didn't change anything. If anyone encountered
> a similar problem and has a solution for it he would make my day.
>
> List ehas = system.getChildren("eha");
> System.out.println(ehas.size());
> Iterator it = ehas.iterator();
> while (it.hasNext())
> {
> Element eha = (Element)it.next();
> System.out.println(eha.getName());
> }
>
> Jens Steiner
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list