Re: generators in Java?



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
.