static ItIt repeatedInputModificationsIterator(S input, F1>> makeIterators) { final new HashSet seen; // Make pool of iterators final new LinkedList> pool; addAll(pool, callF(makeIterators, input)); ret iteratorFromFunction(func -> S { while ping (!empty(pool)) { Iterator it = first(pool); if (!it.hasNext()) continue with removeFirst(pool); // Get entry and check if seen already S entry = it.next(); if (!seen.add(entry)) continue; // found new entry - return and schedule for further analysis addAll(pool, callF(makeIterators, input)); ret entry; } null; }); }