Libraryless. Click here for Pure Java version (7890L/44K).
static L<Int> virtualCountList(int n) { ret new RandomAccessAbstractList<Int>() { public int size() { ret n; } public Int get(int i) { ret i; } }; } // to is exclusive static L<Int> virtualCountList(int from, int to) { int n = max(to-from, 0); ret new RandomAccessAbstractList<Int>() { public int size() { ret n; } public Int get(int i) { ret from+i; } }; }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033229 |
Snippet name: | virtualCountList |
Eternal ID of this version: | #1033229/4 |
Text MD5: | 4ecbe2a1c4840dee2dba59fd7549d4ff |
Transpilation MD5: | afc5b96cd3350f5e5726a5adc06a4da1 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-17 17:33:31 |
Source code size: | 398 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 166 / 248 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1034941 - virtualCountList_incl #1035212 - virtualNullList - list consisting only of nulls |