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

18
LINES

< > BotCompany Repo | #1008649 // addToStringTree

JavaX fragment (include)

1  
ifclass StringTree1
2  
static void addToStringTree(StringTree1 tree, L<S> tokC) {
3  
  if (empty(tokC)) { tree.leaf = true; ret; }
4  
  S s = first(tokC);
5  
  StringTree1 t = tree.getOrAdd(s);
6  
  addToStringTree(t, dropFirst(tokC));
7  
}
8  
endif
9  
10  
ifclass StringTree2
11  
static <A> void addToStringTree(StringTree2<A> tree, L<S> tokC, A leafValue) {
12  
  if (leafValue == null) ret;
13  
  if (empty(tokC)) { tree.leafValue = leafValue; ret; }
14  
  S s = first(tokC);
15  
  StringTree2 t = tree.getOrAdd(s);
16  
  addToStringTree(t, dropFirst(tokC), leafValue);
17  
}
18  
endif

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: #1008649
Snippet name: addToStringTree
Eternal ID of this version: #1008649/6
Text MD5: f1e4ef8608460770b891bd128acb941f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-03 16:47:31
Source code size: 546 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 554 / 583
Version history: 5 change(s)
Referenced in: [show references]