
Signature
Hendrik Maryns
==================
www.lieverleven.be
http://aouw.org
> If I have
>
[quoted text clipped - 11 lines]
> instance of java.lang.Iterable.
> Why does this not work? Or is it a bug in Eclipse?
transitions.entrySet() is already the needed instance of Iterable.
Therefore you have to omit .iterator()
for (Entry<FunctionInputTuple, State> transition :
transitions.entrySet()) { ... }
BTW: I think instead of Entry<...> you have to write Map.Entry<...>

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
Thomas Hawtin - 06 Dec 2005 18:40 GMT
>> Eclipse gives me the error: Can only iterate over an array or an
>> instance of java.lang.Iterable.
>> Why does this not work? Or is it a bug in Eclipse?
It worked in early beta versions of 1.5.0. I believe the rationale for
requiring Iterable and not Iterator, is that it would be less than
obvious that the iterator state is modified. The same goes for passing
iterators to methods. It can be a pain in certain situations.
> BTW: I think instead of Entry<...> you have to write Map.Entry<...>
You can import java.util.Map.Entry;, IIRC. My preference is not to
import more than necessary. Just don't import TreeMap.Entry.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Hendrik Maryns - 07 Dec 2005 11:32 GMT
Thomas Fritsch schreef:
>> If I have
>>
[quoted text clipped - 16 lines]
> for (Entry<FunctionInputTuple, State> transition :
> transitions.entrySet()) { ... }
Yes, I realised ust after posting, and cancelled my post, but not fast
enough, it seems. Thanks anyway.
> BTW: I think instead of Entry<...> you have to write Map.Entry<...>
Eclipse automatically added the line
import java.util.Map.Entry;
the moment I started about Entries...
H.

Signature
Hendrik Maryns
==================
www.lieverleven.be
http://aouw.org
On Tue, 06 Dec 2005 16:03:44 +0100, Hendrik Maryns
<hendrik_maryns@despammed.com> wrote, quoted or indirectly quoted
someone who said :
>Eclipse gives me the error: Can only iterate over an array or an
>instance of java.lang.Iterable.
An Iterable is something that can produce a Iterator e.g. a
Collection, not the Iterator itself. Sun decided not to support all
the things you might naturally expect for : each to support such as
Iterator, Enumeration, char:String, int:String

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.