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

12
LINES

< > BotCompany Repo | #1030689 // byteArrayToList (makes an ArrayList)

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

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

static <A> ArrayList<Byte> byteArrayToList(byte[] a) {
  if (a == null) null;
  ret byteArrayToList(a, 0, a.length);
}

// no range checking on from/to in the interest of speed
static <A> ArrayList<Byte> byteArrayToList(byte[] a, int from, int to) {
  if (a == null) null;
  ArrayList<Byte> l = new(to-from);
  for (int i = from; i < to; i++) l.add(a[i]);
  ret l;
}

Author comment

Began life as a copy of #1025516

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030689
Snippet name: byteArrayToList (makes an ArrayList)
Eternal ID of this version: #1030689/1
Text MD5: 78cffb4e75aec592b6e671442cd22789
Transpilation MD5: 65cf753b2825ea99509d9f91a8834b94
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-07 18:37:27
Source code size: 377 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 131 / 197
Referenced in: [show references]