Libraryless. Click here for Pure Java version (36L/1K).
static L wrapPrimitiveArrayAsImmutableList(O array) { int n = Array.getLength(array); ret new RandomAccessAbstractList() { public int size() { ret n; } public O get(int i) { ret Array.get(array, i); } }; }
Began life as a copy of #1028512
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033085 |
| Snippet name: | wrapPrimitiveArrayAsImmutableList - uses reflection |
| Eternal ID of this version: | #1033085/2 |
| Text MD5: | 5ba437a761ca4d6ee8d9cb36eae8fe85 |
| Transpilation MD5: | e05496354e9ad26325bfc1a4682f9d00 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-14 02:53:51 |
| Source code size: | 225 bytes / 7 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 435 / 588 |
| Version history: | 1 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1033086 - wrapObjectArrayAsImmutableList #1033087 - wrapArrayAsImmutableList - accepts primitive or object array |