List of utility methods to do Array Concatenate
T[] | concat(T[] first, T[]... rest) Conactenates the arrays past as arguments. int totalLength = first.length; for (T[] array : rest) { totalLength += array.length; T[] result = Arrays.copyOf(first, totalLength); int offset = first.length; for (T[] array : rest) { System.arraycopy(array, 0, result, offset, array.length); ... |
T[] | concat(T[] head, T... tail) Concatenates two arrays. T[] result = Arrays.copyOf(head, head.length + tail.length);
System.arraycopy(tail, 0, result, head.length, tail.length);
return result;
|
T[] | concat(T[] left, T[] right) concat return list(chain(Arrays.asList(left), Arrays.asList(right))).toArray(left);
|
String | concat(T[] objects) concat return concat(objects, 0);
|
T[] | concat(T[]... arrays) Concatenates an array of generic arrays if (arrays.length < 2) throw new IllegalArgumentException("At least 2 arrays should be supplied"); T[] result = arrays[0]; for (int i = 1; i < arrays.length; i++) { T[] newArray = Arrays.copyOf(result, result.length + arrays[i].length); System.arraycopy(arrays[i], 0, newArray, result.length, arrays[i].length); result = newArray; return result; |
T[] | concat(T[]... tss) concat int length = 0; for (T[] ts : tss) length += ts.length; T[] res = Arrays.copyOf(tss[0], length); for (int i = 1, p = tss[0].length; i < tss.length; p += tss[i++].length) { System.arraycopy(tss[i], 0, res, p, tss[i].length); return res; ... |
byte[] | concatAll(byte[] a, byte[]... rest) concat All int totalLength = a.length; for (byte[] b : rest) { totalLength += b.length; byte[] result = Arrays.copyOf(a, totalLength); int offset = a.length; for (byte[] array : rest) { System.arraycopy(array, 0, result, offset, array.length); ... |
byte[] | concatAll(byte[] first, byte[]... rest) concat All int totalLength = (first == null) ? 0 : first.length; for (byte[] array : rest) { totalLength += (array == null) ? 0 : array.length; byte[] result = (first == null) ? null : Arrays.copyOf(first, totalLength); int offset = (first == null) ? 0 : first.length; for (byte[] array : rest) { if (array != null) { ... |
byte[] | concatAll(byte[]... args) concat All byte[] cur = concat(args[0], args[1]); for (int i = 2; i < args.length; i++) { cur = concat(cur, args[i]); return cur; |
T[] | concatAll(T[] first, T[]... rest) concat All int totalLength = first.length; for (T[] array : rest) { totalLength += array.length; T[] result = Arrays.copyOf(first, totalLength); int offset = first.length; for (T[] array : rest) { System.arraycopy(array, 0, result, offset, array.length); ... |