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

12
LINES

< > BotCompany Repo | #1030696 // doubleArrayToList (makes an ArrayList)

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

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

static <A> ArrayList<Double> doubleArrayToList(double[] a) {
  if (a == null) null;
  ret doubleArrayToList(a, 0, a.length);
}

// no range checking on from/to in the interest of speed
static <A> ArrayList<Double> doubleArrayToList(double[] a, int from, int to) {
  if (a == null) null;
  ArrayList<Double> 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 #1030689

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1030696
Snippet name: doubleArrayToList (makes an ArrayList)
Eternal ID of this version: #1030696/1
Text MD5: a0645a2c1a99bba3ad4ce26a42cc775c
Transpilation MD5: 0997f0fa42ac3373183d8254fe76e1cb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-08 12:24:25
Source code size: 393 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 138 / 190
Referenced in: [show references]