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

9
LINES

< > BotCompany Repo | #1001795 - arraycopy - shorter + safer version of System.arraycopy (allows null array when n=0)

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

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

static void arraycopy(O[] a, O[] b) {
  if (a != null && b != null)
    arraycopy(a, 0, b, 0, Math.min(a.length, b.length));
}

static void arraycopy(O src, int srcPos, O dest, int destPos, int n) {
  if (n != 0)
    System.arraycopy(src, srcPos, dest, destPos, n);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001795
Snippet name: arraycopy - shorter + safer version of System.arraycopy (allows null array when n=0)
Eternal ID of this version: #1001795/5
Text MD5: 3e9bf5ee7e7fb61bda7779af0f3077cc
Transpilation MD5: 4aa797c1380b9707bf2a96a1a7b0b6aa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-17 13:56:22
Source code size: 275 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 504 / 1625
Version history: 4 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1001795 & http://1001795.tinybrain.de