Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1003343 // unrollTree

JavaX fragment (include)

1  
static <A> L<L<A>> unrollTree(OccTree<A> tree) {
2  
  new L<L<A>> l;
3  
  unrollTree_collect(tree, new ArrayList, l);
4  
  ret l;
5  
}
6  
7  
static <A> void unrollTree_collect(OccTree<A> tree, L<A> l, L<L<A>> out) {
8  
  for (A a : keys(tree.followUp)) {
9  
    l.add(a);
10  
    unrollTree_collect(tree.followUp(a), l, out);
11  
    removeLast(l);
12  
  }
13  
  
14  
  if (empty(tree.followUp))
15  
    out.add(cloneList(l));
16  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003343
Snippet name: unrollTree
Eternal ID of this version: #1003343/1
Text MD5: 1313d93a25bf8a14a31791299307ff50
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-06-19 23:02:38
Source code size: 396 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 582 / 575
Referenced in: [show references]