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

12
LINES

< > BotCompany Repo | #1025516 // intArrayToList (makes an ArrayList)

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

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

static <A> ArrayList<Int> intArrayToList(int[] a) {
  if (a == null) null;
  ret intArrayToList(a, 0, a.length);
}

// no range checking on from/to in the interest of S P E E E E E EEED
static <A> ArrayList<Int> intArrayToList(int[] a, int from, int to) {
  if (a == null) null;
  ArrayList<Int> 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 #1020231

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1025516
Snippet name: intArrayToList (makes an ArrayList)
Eternal ID of this version: #1025516/3
Text MD5: 22ef23851b40ae96b8693bc3f8228cab
Transpilation MD5: cdedad459c72b3a4120e81a19118b351
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-20 21:11:59
Source code size: 382 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 276 / 389
Version history: 2 change(s)
Referenced in: [show references]