Libraryless. Click here for Pure Java version (37L/1K).
1 | static <A> L<A> wrapObjectArrayAsImmutableList(A[] array) {
|
2 | if (array == null) null; |
3 | int n = Array.getLength(array); |
4 | ret new RandomAccessAbstractList<A>() {
|
5 | public int size() { ret n; }
|
6 | public A get(int i) { ret array[i]; }
|
7 | }; |
8 | } |
Began life as a copy of #1033085
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033086 |
| Snippet name: | wrapObjectArrayAsImmutableList |
| Eternal ID of this version: | #1033086/3 |
| Text MD5: | 34a66d1f585cadfde99d5edf7c317041 |
| Transpilation MD5: | 86e2d726dea71652dd4507ef21efd157 |
| 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:58:16 |
| Source code size: | 251 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 438 / 557 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |