static <A> L<A> joinStreaks(O filter, O joiner, L<A> l) { int start = 0; new L out; for (int i = 0; i < l(l); i++) { if (!isTrue(callF(filter, l.get(i)))) { if (i == start+1) out.add(l.get(start)); else if (i > start) out.add(callF(joiner, subList(l, start, i))); start = i+1; out.add(l.get(i)); } } if (start == l(l)-1) out.add(l.get(start)); else if (l(l) > start) out.add(callF(joiner, subList(l, start))); ret out; }
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019353 |
Snippet name: | joinStreaks |
Eternal ID of this version: | #1019353/1 |
Text MD5: | 15e9f3fb8eb42ac4b70e941995e854d7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-03 14:43:00 |
Source code size: | 508 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 281 / 313 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |