List of utility methods to do Array Concatenate
int[] | concat(int[] first, int[] second) concat if (first == null && second == null) { return new int[0]; if (first == null) { return Arrays.copyOf(second, second.length); if (second == null) { return Arrays.copyOf(first, first.length); ... |
int[] | concat(int[]... arrays) Concat arrays in one. assert arrays != null; assert arrays.length > 1; int len = 0; for (int[] a : arrays) len += a.length; int[] r = Arrays.copyOf(arrays[0], len); for (int i = 1, shift = 0; i < arrays.length; i++) { shift += arrays[i - 1].length; ... |
String | concat(Object[] array) Concatenates all elements of an array using the toString() -method.
return concat(array, SPACE);
|
Object[] | concat(Object[] first, Object second) concat Object[] result = Arrays.copyOf(first, first.length + 1); System.arraycopy(new Object[] { second }, 0, result, first.length, 1); return result; |
String | concat(String[] array, String separator) concat StringBuilder sb = new StringBuilder(); String sep = ""; for (String s : array) { sb.append(sep).append(s); sep = separator; return sb.toString(); |
String | concat(String[] parts) concat return Arrays.stream(parts).reduce((a, b) -> a.concat(" ").concat(b)).orElse(""); |
String | concat(String[] strs) concat StringBuilder builder = new StringBuilder(); for (String str : strs) { builder.append(str); return builder.toString(); |
List | concat(String[]... arrays) concat List<String> result = new ArrayList<String>(); for (String[] p : arrays) { for (String x : p) { result.add(x); return result; |
T[] | concat(T val, T[] vals) concat List<T> v = new ArrayList<T>(vals.length + 1); v.add(val); v.addAll(Arrays.asList(vals)); return v.toArray(vals); |
T[] | concat(T[] a, T[] b) concat int al = a.length; int bl = b.length; T[] c = Arrays.copyOf(a, al + bl); for (int i = 0; i < bl; i++) { c[al + i] = b[i]; return c; |