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

6
LINES

< > BotCompany Repo | #1004161 // indexOfOccurrence

JavaX fragment (include)

1  
static <A> int indexOfOccurrence(L<A> l, A x, int n) {
2  
  for (int i = 0; i < l(l); i++)
3  
    if (eq(l.get(i), x) && --n < 0)
4  
      ret i;
5  
  ret -1;
6  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004161
Snippet name: indexOfOccurrence
Eternal ID of this version: #1004161/1
Text MD5: 9b14e7616983e4790acff5d6b5bc0feb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-08 17:30:38
Source code size: 153 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 588 / 598
Referenced in: [show references]