Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1033086 // wrapObjectArrayAsImmutableList

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (37L/1K).

static <A> L<A> wrapObjectArrayAsImmutableList(A[] array) {
  if (array == null) null;
  int n = Array.getLength(array);
  ret new RandomAccessAbstractList<A>() {
    public int size() { ret n; }
    public A get(int i) { ret array[i]; }
  };
}

Author comment

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: 102 / 160
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1033118 - intListToByteList_littleEndian - wrap as virtual list with get/set