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

10
LINES

< > BotCompany Repo | #1006686 // indexOfPred - index of first element in list that matches a predicate

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1691L/11K).

static int indexOfPred(L l, O pred) {
  for i over l:
    if (checkCondition(pred, l.get(i)))
      ret i;
  ret -1;
}

static <A, B> int indexOfPred(L<A> l, IF1<A, B> pred) {
  ret indexOfPred(l, (O) pred);
}

Author comment

Began life as a copy of #1006407

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006686
Snippet name: indexOfPred - index of first element in list that matches a predicate
Eternal ID of this version: #1006686/3
Text MD5: 12b19b548619daa0fec48d8fb326f9b4
Transpilation MD5: dcc43138e70cf8bb51eb71029c23c392
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-07 23:42:37
Source code size: 218 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 565 / 679
Version history: 2 change(s)
Referenced in: [show references]