Is there a simple way of testing if the generator has no items, like peek, hasNext, isEmpty, something along those lines?
There's a very simple solution: if next(generator,-1) == -1 then the generator is empty!
How do I know if a generator is empty from the start?