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

13
LINES

< > BotCompany Repo | #1001160 // findEndOfTypeArgs

JavaX fragment (include)

1  
// i must point at the opening bracket ("<")
2  
// index returned is index of closing bracket + 1
3  
static int findEndOfTypeArgs(L<S> cnc, int i) {
4  
  int j = i+2, level = 1;
5  
  while (j < cnc.size()) {
6  
    if (cnc.get(j).equals("<")) ++level;
7  
    else if (cnc.get(j).equals(">")) --level;
8  
    if (level == 0)
9  
      return j+1;
10  
    ++j;
11  
  }
12  
  return cnc.size();
13  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001160
Snippet name: findEndOfTypeArgs
Eternal ID of this version: #1001160/3
Text MD5: 9c5d13d5323a1039d5959bda309fed3c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-14 02:29:26
Source code size: 370 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 756 / 1212
Version history: 2 change(s)
Referenced in: [show references]