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 (35L/1K).

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

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

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, 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/6
Text MD5: 37a2e6705ad9ec2f5f7a5d87f2c07fab
Transpilation MD5: 045b9b40e55b316adca4198d9b56b04a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-22 14:57:12
Source code size: 275 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 643 / 1861
Version history: 5 change(s)
Referenced in: [show references]