Libraryless. Click here for Pure Java version (2480L/16K).
1 | static <A> int smartIndexOfPred(L<A> l, IPred<A> pred) {
|
2 | ret smartIndexOfPred(l, pred, 0); |
3 | } |
4 | |
5 | static <A> int smartIndexOfPred(L<A> l, IPred<A> pred, int i) {
|
6 | int n = l(l); |
7 | for (; i < n; i++) |
8 | if (pred.get(l.get(i))) |
9 | ret i; |
10 | ret n; |
11 | } |
Began life as a copy of #1006686
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1027876 |
| Snippet name: | smartIndexOfPred - index of first element in list that matches a predicate |
| Eternal ID of this version: | #1027876/5 |
| Text MD5: | 60769eefd6dc1c1f4da2e14766147244 |
| Transpilation MD5: | b81efc4b25312522aaa39d3f1651f243 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-04-16 14:26:40 |
| Source code size: | 258 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 459 / 587 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |