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

String[][]arraycat(String[][] array1, String[][] array2)
Concatenates two String[][] arrays.
String[][] Result = new String[array1.length + array2.length][];
int i = 0;
for (int j = 0; j < array1.length; j++)
    Result[i++] = array1[j];
for (int j = 0; j < array2.length; j++)
    Result[i++] = array2[j];
return Result;
byte[]arrayConcat(byte[] a, byte[] b)
array Concat
int lenA = a.length;
int lenB = b.length;
byte[] out = new byte[lenA + lenB];
System.arraycopy(a, 0, out, 0, lenA);
System.arraycopy(b, 0, out, lenA, lenB);
return out;
byte[]arrayConcat(final byte[] firstArray, final byte[] secondArray)
array Concat
final int aLen = firstArray.length;
final int bLen = secondArray.length;
final byte[] combinedArray = new byte[aLen + bLen];
System.arraycopy(firstArray, 0, combinedArray, 0, aLen);
System.arraycopy(secondArray, 0, combinedArray, aLen, bLen);
return combinedArray;
String[]arrayConcat(String[] first, String second)
Returns a new array adding the second array at the end of first array.
if (second == null)
    return first;
if (first == null)
    return new String[] { second };
int length = first.length;
if (first.length == 0) {
    return new String[] { second };
String[] result = new String[length + 1];
System.arraycopy(first, 0, result, 0, length);
result[length] = second;
return result;
T[]arrayConcat(T[] a, T[] b)
array Concat
if (a == null)
    throw new IllegalArgumentException("'a' can't be null");
if (b == null)
    throw new IllegalArgumentException("'b' can't be null");
T[] rn = Arrays.copyOf(a, a.length + b.length);
System.arraycopy(b, 0, rn, a.length, b.length);
T[] r = rn;
return r;
...
T[]arrayConcat(T[] first, T[] second)
Concatenate two arrays of type T and produce a new of the same type.
T[] combinedArray = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, combinedArray, first.length, second.length);
return combinedArray;
T[]arrayConcat(T[] first, T[] second)
Concatenate two arrays.
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
String[]arrayConcatenate(final String[] f, final String[] s)
array Concatenate
final int fLen = (f == null ? 0 : f.length);
final int sLen = (s == null ? 0 : s.length);
final int len = fLen + sLen;
final String[] ret = new String[len];
if (fLen > 0) {
    System.arraycopy(f, 0, ret, 0, fLen);
    if (sLen > 0) {
        System.arraycopy(s, 0, ret, fLen, sLen);
...
String[]arrayConcatenate(String[] first, String[] second)
array Concatenate
String[] ret = new String[first.length + second.length];
System.arraycopy(first, 0, ret, 0, first.length);
System.arraycopy(second, 0, ret, first.length, second.length);
return ret;
int[]arrayConcatInt(final int[] original, final int[] appender)
Concatenates two integer arrays
final int[] result = Arrays.copyOf(original, original.length + appender.length);
System.arraycopy(appender, 0, result, original.length, appender.length);
return result;