1 | static L<IntRange> joinIntRangesWithDistanceLessThan(L<IntRange> l, int threshold) {
|
2 | new L<IntRange> out; |
3 | |
4 | for i over l: {
|
5 | IntRange r = l.get(i); |
6 | if (i == 0 || r.start-last(out).end >= threshold) |
7 | out.add(r); |
8 | else |
9 | setLast(out, intRange(last(out).start, r.end)); |
10 | } |
11 | |
12 | ret out; |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1018789 |
| Snippet name: | joinIntRangesWithDistanceLessThan |
| Eternal ID of this version: | #1018789/1 |
| Text MD5: | 55b0d5da156b8eca31e15d047389b6d1 |
| Author: | stefan |
| Category: | javax / math |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-10-13 18:39:34 |
| Source code size: | 322 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 649 / 692 |
| Referenced in: | [show references] |