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

9
LINES

< > BotCompany Repo | #1029482 // intersectIntRanges

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2628L) is out of date.

1  
static IntRange intersectIntRanges(IntRange a, IntRange b) {
2  
  int start = max(a.start, b.start);
3  
  int end = min(a.end, b.end);
4  
  ret start <= end ? IntRange(start, end) : null;
5  
}
6  
7  
static L<IntRange> intersectIntRanges(Iterable<IntRange> l, IntRange b) {
8  
  ret map(l, r -> intersectIntRanges(r, b));
9  
}

Author comment

Began life as a copy of #1028623

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029482
Snippet name: intersectIntRanges
Eternal ID of this version: #1029482/4
Text MD5: 81b7a1cfe4c040ecb92a266432adfa4d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-30 00:59:23
Source code size: 310 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 257 / 320
Version history: 3 change(s)
Referenced in: [show references]