Libraryless. Click here for Pure Java version (1779L/12K).
static L<IntRange> bitSetStreaks(BitSet bs) { new L<IntRange> streaks; if (bs == null) ret streaks; int n = bs.length(); int i = -1; while true { i = bs.nextSetBit(i+1); if (i < 0) break; int j = bs.nextClearBit(i+1); streaks.add(intRange(i, j)); i = j; } ret streaks; }
Began life as a copy of #1024612
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024613 |
Snippet name: | bitSetStreaks |
Eternal ID of this version: | #1024613/3 |
Text MD5: | fe1616982d4424766028b2891506c35d |
Transpilation MD5: | 8bac8d0dd6a60e2ed4d3f31f615828bd |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-20 00:09:48 |
Source code size: | 317 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 210 / 293 |
Version history: | 2 change(s) |
Referenced in: | [show references] |