The list of methods to do Array Append are organized into topic(s).
int[]
addToArray(int[] a, int value) add To Array
if (a == null || a.length == 0) {
return new int[] { value };
int[] array = Arrays.copyOf(a, a.length + 1);
array[a.length] = value;
return array;
String[]
addToArray(String[] items, String str) Adds a string to a string array.
List<String> itemList;
if (items == null) {
itemList = new ArrayList<String>();
} else {
itemList = new ArrayList<String>(Arrays.asList(items));
if (str != null) {
itemList.add(str);
...
byte[]
appendArray(final byte[] buffer1, final byte[] buffer2) Appends the second array to the first array.
final byte[] newBuffer = new byte[buffer1.length + buffer2.length];
int pos = 0;
System.arraycopy(buffer1, 0, newBuffer, pos, buffer1.length);
pos += buffer1.length;
System.arraycopy(buffer2, 0, newBuffer, pos, buffer2.length);
return newBuffer;
int[][]
appendArray(int[][] array, int[] staple) append Array
int[][] output = new int[array.length + 1][];
System.arraycopy(array, 0, output, 0, array.length);
output[array.length] = staple;
return output;
Object[]
appendArray(Object[] arr, Object obj) Append an Object at end of array
Object[] newArr = new Object[arr.length + 1];
System.arraycopy(arr, 0, newArr, 0, arr.length);
newArr[arr.length] = obj;
return newArr;
Object[]
appendArray(Object[] array1, Object[] array2) Appends array2 to the end of array1 and returns the result
Object[] result = new Object[array1.length + array2.length];
System.arraycopy(array1, 0, result, 0, array1.length);
System.arraycopy(array2, 0, result, array1.length, array2.length);
return result;