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

12
LINES

< > BotCompany Repo | #1029189 // longArrayToList (makes an ArrayList)

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

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

static <A> ArrayList<Long> longArrayToList(long[] a) {
  if (a == null) null;
  ret longArrayToList(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<Long> longArrayToList(long[] a, int from, int to) {
  if (a == null) null;
  ArrayList<Long> 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 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029189
Snippet name: longArrayToList (makes an ArrayList)
Eternal ID of this version: #1029189/1
Text MD5: 02eb9f0640fff413c2c9cc7e93ade82a
Transpilation MD5: c93767995720baec018b5bcf18a418fe
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-24 17:28:16
Source code size: 390 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 169 / 249
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)