Libraryless. Click here for Pure Java version (2839L/17K).
static LPair<IntRange, Bool> bitSetStreaksAndNonStreaks(BitSet bs, int n) { int start = 0; Bool last = null; new LPair<IntRange, Bool> out; for i to n: { Bool result = bs.get(i); if (last != null && neq(result, last)) { out.add(pair(intRange(start, i), last)); start = i; } last = result; } if (start < n) out.add(pair(intRange(start, n), last)); ret out; }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030965 |
Snippet name: | bitSetStreaksAndNonStreaks |
Eternal ID of this version: | #1030965/2 |
Text MD5: | 19e8baa541d04c5718f0915cff8c6a70 |
Transpilation MD5: | 4ddf329b7f8109e4bc618ed1c3de0d4e |
Author: | stefan |
Category: | javax / html |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-16 15:11:24 |
Source code size: | 419 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 154 / 227 |
Version history: | 1 change(s) |
Referenced in: | [show references] |