static ItIt ai_dropTrailingPhrases_repeat(S s, Collection phrases) { final Set set = asCISet(phrases); // Make pool of iterators final L> pool = ll_linkedList((Iterator) ai_dropTrailingPhrases(s, set)); ret iteratorFromFunction(func -> S { while ping (!empty(pool)) { Iterator it = first(pool); if (!it.hasNext()) continue with removeFirst(pool); // found entry - return and schedule for further analysis S entry = it.next(); pool.add(ai_dropTrailingPhrases(entry, set)); ret entry; } }); }