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

13
LINES

< > BotCompany Repo | #1001160 // findEndOfTypeArgs

JavaX fragment (include)

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

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: 755 / 1211
Version history: 2 change(s)
Referenced in: #1001165 - findEndOfBracketPart
#1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017380 - tok_findEndOfTypeArg
#1023407 - tok_findEndOfType
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)