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

26
LINES

< > BotCompany Repo | #1026917 // toDoubleArray

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

Transpiled version (134L) is out of date.

static double[] toDoubleArray(Cl<Double> l) {
  double[] a = new double[l(l)];
  int i = 0;
  if (a.length != 0) for (double x : l)
    a[i++] = x;
  ret a;
}

ifclass IntBuffer
static double[] toDoubleArray(IntBuffer b) {
  int n = l(b);
  double[] a = new [n];
  for i to n:
    a[i] = b.get(i);
  ret a;
}
endif

meta-for float also as int {
  static double[] toDoubleArray(float... l) {
    double[] a = new[l(l)];
    for (int i = 0; i < a.length; i++)
      a[i] = l[i];
    ret a;
  }
}

Author comment

Began life as a copy of #1004992

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: #1026917
Snippet name: toDoubleArray
Eternal ID of this version: #1026917/7
Text MD5: 5e28bd0ba272275a117b7b94111bc2a7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-17 02:12:32
Source code size: 518 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 139 / 220
Version history: 6 change(s)
Referenced in: [show references]