1 | static <A> int indexOfAny(L<A> l, int i, A... x) {
|
2 | while (i < l(l)) |
3 | if (eqOneOf(l.get(i), x)) ret i; else ++i; |
4 | ret -1; |
5 | } |
6 | |
7 | static <A> int indexOfAny(L<A> l, Collection<A> x) {
|
8 | ret indexOfAny(l, 0, x); |
9 | } |
10 | |
11 | static <A> int indexOfAny(L<A> l, int i, Collection<A> x) {
|
12 | if (nempty(x)) |
13 | while (i < l(l)) |
14 | if (x.contains(l.get(i))) ret i; else ++i; |
15 | ret -1; |
16 | } |
17 | |
18 | static int indexOfAny(S s, int i, S chars) {
|
19 | for (; i < l(s); i++) |
20 | if (chars.indexOf(s.charAt(i)) >= 0) |
21 | ret i; |
22 | ret -1; |
23 | } |
24 | |
25 | static int indexOfAny(S s, S chars) { ret indexOfAny(s, 0, chars); } |
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: | #1007655 |
| Snippet name: | indexOfAny - index of one of multiple elements |
| Eternal ID of this version: | #1007655/10 |
| Text MD5: | 2ebf2b8500d5a7b2fd2d853d0197763d |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-06-29 18:53:47 |
| Source code size: | 601 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 972 / 990 |
| Version history: | 9 change(s) |
| Referenced in: | [show references] |