1 | static <A> LL<A> mapLike streaksAndNonStreaks(O pred, L<A> l) { |
2 | new LL<A> out; |
3 | int start = 0; |
4 | Bool last = null; |
5 | for i over l: { |
6 | Bool result = (Bool) callF(pred, l.get(i)); |
7 | if (last != null && result != null && neq(result, last)) { |
8 | out.add(subList(l, start, i)); |
9 | start = i; |
10 | } |
11 | if (result != null) last = result; |
12 | } |
13 | if (start < l(l)) |
14 | out.add(subList(l, start)); |
15 | ret out; |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023224 |
Snippet name: | streaksAndNonStreaks - predicate may also return null |
Eternal ID of this version: | #1023224/7 |
Text MD5: | c245dcf48cccd0cd9f578e4bf45eff89 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-17 00:01:48 |
Source code size: | 429 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 253 / 296 |
Version history: | 6 change(s) |
Referenced in: | [show references] |