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

27
LINES

< > BotCompany Repo | #1003162 // cloneArray

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

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

static int[] cloneArray(int[] a) {
  if (a == null) null;
  int[] b = new int[a.length];
  System.arraycopy(a, 0, b, 0, a.length);
  ret b;
}

static bool[] cloneArray(bool[] a) {
  if (a == null) null;
  bool[] b = new bool[a.length];
  System.arraycopy(a, 0, b, 0, a.length);
  ret b;
}

static short[] cloneArray(short[] a) {
  if (a == null) null;
  short[] b = new short[a.length];
  System.arraycopy(a, 0, b, 0, a.length);
  ret b;
}

static <A> A[] cloneArray(A[] a) {
  if (a == null) null;
  A[] b = arrayOfSameType(a, a.length);
  System.arraycopy(a, 0, b, 0, a.length);
  ret b;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1003162
Snippet name: cloneArray
Eternal ID of this version: #1003162/4
Text MD5: d6d3dd925c6817149d8fd055375607b6
Transpilation MD5: b4ae2bb05f70f7e7e702625211a93345
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-02 04:39:19
Source code size: 617 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 591 / 640
Version history: 3 change(s)
Referenced in: [show references]