1 | static <A extends Iterator<S>> ItIt<S> repeatedInputModificationsIterator(S input, final F1<S, L<A>> makeIterators) {
|
2 | final HashSet<S> seen = lithashset(input); |
3 | |
4 | // Make pool of iterators |
5 | final new LinkedList<Iterator<S>> pool; |
6 | addAll(pool, callF(makeIterators, input)); |
7 | ret iteratorFromFunction(func -> S {
|
8 | while ping (!empty(pool)) {
|
9 | Iterator<S> it = first(pool); |
10 | if (!it.hasNext()) continue with removeFirst(pool); |
11 | |
12 | // Get entry and check if seen already |
13 | S entry = it.next(); |
14 | if (!seen.add(entry)) continue; |
15 | |
16 | // found new entry - return and schedule for further analysis |
17 | addAll(pool, callF(makeIterators, entry)); |
18 | ret entry; |
19 | } |
20 | null; |
21 | }); |
22 | } |
Began life as a copy of #1018117
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1018118 |
| Snippet name: | repeatedInputModificationsIterator |
| Eternal ID of this version: | #1018118/9 |
| Text MD5: | b586b34ed0c469e464f21345817a3e65 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-09-02 17:10:44 |
| Source code size: | 742 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 610 / 662 |
| Version history: | 8 change(s) |
| Referenced in: | [show references] |