Revision: 37308
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 8, 2010 07:29 by Voil
Initial Code
public void arraycopy(char[] source, int copyFrom, char[] target, int copyTo, int length) { // Input validation if(source == null || target == null) return; if(copyFrom+length >= source.length || copyTo+length > source.length) return; // Same as: System.arraycopy(source, copyFrom, target, copyTo, length); for(int i=0;i<length;i++) { target[copyTo+i] = source[copyFrom+i]; } }
Initial URL
Initial Description
Does the same as `System.arraycopy(source, copyFrom ,target, copyTo, length)` but without worrying about invalid input. Example for an array of characters.
Initial Title
Safe `arraycopy` Method
Initial Tags
array
Initial Language
Java