Libraryless. Click here for Pure Java version (1779L/12K).
1 | static L<IntRange> bitSetStreaks(BitSet bs) { |
2 | new L<IntRange> streaks; |
3 | if (bs == null) ret streaks; |
4 | int n = bs.length(); |
5 | int i = -1; |
6 | while true { |
7 | i = bs.nextSetBit(i+1); |
8 | if (i < 0) break; |
9 | int j = bs.nextClearBit(i+1); |
10 | streaks.add(intRange(i, j)); |
11 | i = j; |
12 | } |
13 | ret streaks; |
14 | } |
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: | 212 / 296 |
Version history: | 2 change(s) |
Referenced in: | [show references] |