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

11
LINES

< > BotCompany Repo | #1008650 // walkStringTreeToLeaf

JavaX fragment (include)

1  
// -1 if no matching leaf found, otherwise number of steps to get there
2  
static int walkStringTreeToLeaf(StringTree1 tree, L<S> items) {
3  
  int i = 0;
4  
  while (tree != null && i < l(items)) {
5  
    if (tree.leaf)
6  
      ret i;
7  
    tree = tree.children.get(items.get(i));
8  
    ++i;
9  
  }
10  
  ret -1;
11  
}

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: #1008650
Snippet name: walkStringTreeToLeaf
Eternal ID of this version: #1008650/1
Text MD5: c8812d5de4414ed1762071abc3b3705c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-26 19:34:11
Source code size: 300 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 483 / 508
Referenced in: [show references]