Libraryless. Click here for Pure Java version (2971L/17K).
1 | static <A> L<A> subList(L<A> l, int startIndex) { |
2 | ret subList(l, startIndex, l(l)); |
3 | } |
4 | |
5 | static <A> L<A> subList(int startIndex, L<A> l) { |
6 | ret subList(l, startIndex); |
7 | } |
8 | |
9 | static <A> L<A> subList(int startIndex, int endIndex, L<A> l) { |
10 | ret subList(l, startIndex, endIndex); |
11 | } |
12 | |
13 | static <A> L<A> subList(L<A> l, int startIndex, int endIndex) { |
14 | if (l == null) null; |
15 | int n = l(l); |
16 | startIndex = Math.max(0, startIndex); |
17 | endIndex = Math.min(n, endIndex); |
18 | if (startIndex > endIndex) ret ll(); |
19 | if (startIndex == 0 && endIndex == n) ret l; |
20 | ifdef OurSubLists |
21 | ret ourSubList_noRangeCheck(l, startIndex, endIndex); |
22 | endifdef |
23 | ifndef OurSubLists |
24 | ret l.subList(startIndex, endIndex); |
25 | endifndef |
26 | } |
27 | |
28 | ifclass IntRange |
29 | static <A> L<A> subList(L<A> l, IntRange r) { |
30 | ret subList(l, r.start, r.end); |
31 | } |
32 | endif |
Began life as a copy of #1001911
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1002310 |
Snippet name: | subList function - use instead of List.subList |
Eternal ID of this version: | #1002310/9 |
Text MD5: | 561528862a976b860c0a1ac7f8d48688 |
Transpilation MD5: | dd1ab59fd583a71fbca9b917a63ae519 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-24 02:46:12 |
Source code size: | 845 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 1036 / 4405 |
Version history: | 8 change(s) |
Referenced in: | [show references] |