Libraryless. Click here for Pure Java version (2887L/18K).
1 | static <A> ItIt<A> uniqueRecursiveIterator(Cl<A> rootElements, IF1<A, Iterable<A>> getChildren) { |
2 | new Set<A> set; |
3 | addAll(set, rootElements); |
4 | LinkedList<A> queue = cloneAsLinkedList(set); |
5 | ret iff(func { |
6 | if (empty(queue)) |
7 | ret endMarker(); |
8 | A a = popFirst(queue); |
9 | addAllWithTesterSet(queue, set, getChildren.get(a)); |
10 | ret a; |
11 | }); |
12 | } |
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: | 182 / 258 |
Version history: | 2 change(s) |
Referenced in: | [show references] |