Libraryless. Click here for Pure Java version (2887L/18K).
static <A> ItIt<A> uniqueRecursiveIterator(Cl<A> rootElements, IF1<A, Iterable<A>> getChildren) { new Set<A> set; addAll(set, rootElements); LinkedList<A> queue = cloneAsLinkedList(set); ret iff(func { if (empty(queue)) ret endMarker(); A a = popFirst(queue); addAllWithTesterSet(queue, set, getChildren.get(a)); ret a; }); }
Began life as a copy of #1029281
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1029309 |
| Snippet name: | uniqueRecursiveIterator - only returns each element once |
| Eternal ID of this version: | #1029309/3 |
| Text MD5: | a122ff4d97fcdf95d026a682a920026a |
| Transpilation MD5: | cb4ee5f584bc2e9124e2a341d76d76a0 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-07-30 18:17:04 |
| Source code size: | 368 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 370 / 482 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |