Libraryless. Click here for Pure Java version (39L/1K).
1 | // virtual view into a list that with a "gap" (elements in the middle being removed) |
2 | static <A> L<A> lineComp_listWithGap(L<A> l, int copyTo, int copyFrom) {
|
3 | if (copyFrom == copyTo) ret l; |
4 | ret new RandomAccessAbstractList<A> {
|
5 | int size = l.size()-(copyFrom-copyTo); |
6 | public int size() { ret size; }
|
7 | public A get(int i) {
|
8 | ret l.get(i < copyTo ? i : i+(copyFrom-copyTo)); |
9 | } |
10 | }; |
11 | } |
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: | #1028243 |
| Snippet name: | lineComp_listWithGap |
| Eternal ID of this version: | #1028243/5 |
| Text MD5: | d253a4779ef6f7f5c1fdad73ce01e7a4 |
| Transpilation MD5: | 0bf3edf4e1f1dd8f15bf1159b2fb0a2b |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-05-27 22:21:46 |
| Source code size: | 413 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 383 / 541 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |