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

9
LINES

< > BotCompany Repo | #1018627 // mergeIntRangesCloserThan

JavaX fragment (include)

static L<IntRange> mergeIntRangesCloserThan(final int threshold, L<IntRange> l) {
  new L<IntRange> out;
  for (IntRange r : l)
    if (nempty(out) && r.start <= last(out).end+threshold)
      replaceLast(out, intRange(last(out).start, r.end));
    else
      out.add(r);
  ret out;
}

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: 287 / 314
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)