Java Utililty Methods Array Concatenate

List of utility methods to do Array Concatenate

Description

The list of methods to do Array Concatenate are organized into topic(s).

Method

T[]concat(T[] a, T[] b, T[] c, T[] d)
concat
return list(chain(list(a), list(b), list(c), list(d))).toArray(a);
T[]concat(T[] arr0, @SuppressWarnings("unchecked") T[]... more)
Concats the given arrays into a single array.
int size = arr0.length;
for (T[] a : more)
    size += a.length;
T[] r = Arrays.copyOf(arr0, size);
int o = arr0.length;
for (T[] a : more) {
    System.arraycopy(a, 0, r, o, a.length);
    o += a.length;
...
T[]concat(T[] array, Collection collection)
concat
if (collection == null || collection.isEmpty()) {
    return array;
return concat(array, (T[]) collection.toArray());
T[]concat(T[] array1, T[] array2)
Concatenates two arrays as one
if (array1 != null && array2 != null) {
    T[] result = Arrays.copyOf(array1, array1.length + array2.length);
    System.arraycopy(array2, 0, result, array1.length, array2.length);
    return result;
if (array1 == null && array2 != null) {
    return array2;
if (array1 != null && array2 == null) {
    return array1;
return null;
T[]concat(T[] array1, T[] array2)
concat
T[] newarray = Arrays.copyOf(array1, array1.length + array2.length);
for (int i = 0; i < array2.length; i++) {
    newarray[array1.length + i] = array2[i];
return newarray;
T[]concat(T[] first, @SuppressWarnings("unchecked") T... second)
concat
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
T[]concat(T[] first, T[] second)
concat
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
T[]concat(T[] first, T[] second)
concat
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
T[]concat(T[] first, T[] second)
This method concatenates two arrays and returns a new array with the result
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
T[]concat(T[] first, T[] second)
Concats two arrays in to one
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;