static L<IntRange> invertIntRanges(L<IntRange> l, int start, int end) { new L<IntRange> out; int x = start, i = 0; while (i < l(l)) { int y = l.get(i).start; if (y > x) out.add(intRange(x, y)); x = l.get(i).end; ++i; } if (end > x) out.add(intRange(x, end)); 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: | #1019223 |
| Snippet name: | invertIntRanges - return holes as ranges |
| Eternal ID of this version: | #1019223/1 |
| Text MD5: | c628d5cfdca6d922c898c40f77c203fb |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-10-28 00:47:38 |
| Source code size: | 308 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 496 / 557 |
| Referenced in: | [show references] |