generators in Java?
Diez B. Roggisch
deets at nospam.web.de
Sat Dec 31 04:44:49 EST 2005
Tom Sheffler schrieb:
>
> This may have been discussed before, so I apologize.
>
> Does Java have generators? I am aware of the "Iterator" interface,
> but it seems much more restrictive. Python generators are useful
> for many more things than simply list enumeration, but the Java
> Iterator seems limited.
No, it hasn't. One thing people do is to create threads that communicate
via a queue and block while that queue has an item in it. But of course
that comes at additional overhead of thread context switching.
Regards,
Diez
More information about the Python-list
mailing list