Libraryless. Click here for Pure Java version (2748L/16K).
static <A> L<A> wrapAsReversedList(A[] array) { int n = l(array); ret new RandomAccessAbstractList<A> { public int size() { ret n; } public A get(int i) { ret array[n-1-i]; } public A set(int i, A a) { A old = array[n-1-i]; array[n-1-i] = a; ret old; } }; }
Began life as a copy of #1029070
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt, wnsclhtenguj
No comments. add comment
Snippet ID: | #1030633 |
Snippet name: | wrapAsReversedList |
Eternal ID of this version: | #1030633/5 |
Text MD5: | 96c74c5481b250cafb9c5f03c282ceab |
Transpilation MD5: | 86190fc2cb79a5166e6a8313e15f5adc |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-02-09 10:28:30 |
Source code size: | 308 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 181 / 299 |
Version history: | 4 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1031197 - AutoGrowingList - this only grows on set |