static <A> int indexOfSubList(L<A> x, L<A> y) {
ret indexOfSubList(x, y, 0);
}
static <A> int indexOfSubList(L<A> x, L<A> y, int i) {
outer: for (; i+l(y) <= l(x); i++) {
for (int j = 0; j < l(y); j++)
if (neq(x.get(i+j), y.get(j)))
continue outer;
ret i;
}
ret -1;
}
static <A> int indexOfSubList(L<A> x, A[] y, int i) {
outer: for (; i+l(y) <= l(x); i++) {
for (int j = 0; j < l(y); j++)
if (neq(x.get(i+j), y[j]))
continue outer;
ret i;
}
ret -1;
}download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1002135 |
| Snippet name: | indexOfSubList |
| Eternal ID of this version: | #1002135/2 |
| Text MD5: | 8a6b4117739d0611074e3d34e07179bc |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-04-13 18:05:23 |
| Source code size: | 533 bytes / 23 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1305 / 2805 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |