static <A> L<A> newSubListOrSame(L<A> l, int startIndex) {
ret newSubListOrSame(l, startIndex, l(l));
}
static <A> L<A> newSubListOrSame(L<A> l, int startIndex, int endIndex) {
if (l == null) null;
int n = l(l);
startIndex = max(0, startIndex);
endIndex = min(n, endIndex);
if (startIndex >= endIndex) ret ll();
if (startIndex == 0 && endIndex == n) ret l;
ret cloneList(l.subList(startIndex, endIndex));
}
ifclass IntRange
static <A> L<A> newSubListOrSame(L<A> l, IntRange r) {
ret newSubListOrSame(l, r.start, r.end);
}
endifBegan life as a copy of #1002310
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1019581 |
| Snippet name: | newSubListOrSame - return cloned subList or original list if full range |
| Eternal ID of this version: | #1019581/4 |
| Text MD5: | d7010a19f1b804ffa1cc3748eb9e8a7a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-03-04 10:38:14 |
| Source code size: | 565 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 861 / 893 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |