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

9
LINES

< > BotCompany Repo | #1012579 // indexOfFirstChange - find first change in a list

JavaX fragment (include)

static <A> int indexOfFirstChange(L<A> l) {
  int n = l(l);
  if (n < 2) ret -1;
  O value = l.get(0);
  for (int i = 1; i < n; i++)
    if (neq(value, l.get(i)))
      ret i;
  ret -1;
}

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: #1012579
Snippet name: indexOfFirstChange - find first change in a list
Eternal ID of this version: #1012579/1
Text MD5: 0bd0d1e00726e4492c8bbec680b70f4a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-07 14:09:00
Source code size: 195 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 470 / 486
Referenced in: [show references]