From: "Henri Yandell" <[EMAIL PROTECTED]>
> Because I've never understood this, what is with the habit of using
> Enumeration and Iterators in for loops?
>
> What does it have over the while loop version? Just the fact it keeps the
> 'iter' variable in the loops scope?

Yes. So I think this is possible

for ( Iterator iter = foo.iterator(); iter.hasNext(); ) {
    ..
}

for ( Iterator iter = bar.iterator(); iter.hasNext(); ) {
    ..
}


> [as for foreach, I would love to have one. It should also handle Maps a la
>  foreach(Object key, String value in map) {
>  ...
>  }
>  and handle the cast to a String automatically.
> ]

Agreed - that'd be nice.

James


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to