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).

1  
static <A> ArrayList<Int> intArrayToList(int[] a) {
2  
  if (a == null) null;
3  
  ret intArrayToList(a, 0, a.length);
4  
}
5  
6  
// no range checking on from/to in the interest of S P E E E E E EEED
7  
static <A> ArrayList<Int> intArrayToList(int[] a, int from, int to) {
8  
  if (a == null) null;
9  
  ArrayList<Int> l = new(to-from);
10  
  for (int i = from; i < to; i++) l.add(a[i]);
11  
  ret l;
12  
}

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: 277 / 390
Version history: 2 change(s)
Referenced in: [show references]