1 | static <A> int indexOfFirstChange(L<A> l) { |
2 | int n = l(l); |
3 | if (n < 2) ret -1; |
4 | O value = l.get(0); |
5 | for (int i = 1; i < n; i++) |
6 | if (neq(value, l.get(i))) |
7 | ret i; |
8 | ret -1; |
9 | } |
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: | 472 / 489 |
Referenced in: | [show references] |