Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1018627 // mergeIntRangesCloserThan

JavaX fragment (include)

1  
static L<IntRange> mergeIntRangesCloserThan(final int threshold, L<IntRange> l) {
2  
  new L<IntRange> out;
3  
  for (IntRange r : l)
4  
    if (nempty(out) && r.start <= last(out).end+threshold)
5  
      replaceLast(out, intRange(last(out).start, r.end));
6  
    else
7  
      out.add(r);
8  
  ret out;
9  
}

Author comment

Began life as a copy of #1018624

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: #1018627
Snippet name: mergeIntRangesCloserThan
Eternal ID of this version: #1018627/1
Text MD5: f4b66e0aea4a19e03d344c20e20fb09a
Author: stefan
Category: javax / math
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-08 01:25:23
Source code size: 292 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 286 / 313
Referenced in: [show references]