@Test @DisplayName("When one array is null the other one is returned") void nullArrayJoinReturnsTheOther() { final var a = new Object[4]; Assertions.assertSame(a, ArrayTools.join(null, a)); Assertions.assertSame(a, ArrayTools.join(a, null)); }
public static <T> T[] join(T[] a, T[] b) { if (a == null) { return b; } else { if (b == null) { return a; } final var array = Arrays.copyOf(a, a.length + b.length); System.arraycopy(b, 0, array, a.length, b.length); return array; } }
ArrayTools { public static <T> T[] join(T[] a, T[] b) { if (a == null) { return b; } else { if (b == null) { return a; } final var array = Arrays.copyOf(a, a.length + b.length); System.arraycopy(b, 0, array, a.length, b.length); return array; } } }
ArrayTools { public static <T> T[] join(T[] a, T[] b) { if (a == null) { return b; } else { if (b == null) { return a; } final var array = Arrays.copyOf(a, a.length + b.length); System.arraycopy(b, 0, array, a.length, b.length); return array; } }  }
ArrayTools { public static <T> T[] join(T[] a, T[] b) { if (a == null) { return b; } else { if (b == null) { return a; } final var array = Arrays.copyOf(a, a.length + b.length); System.arraycopy(b, 0, array, a.length, b.length); return array; } }  static T[] join(T[] a, T[] b); }
ArrayTools { public static <T> T[] join(T[] a, T[] b) { if (a == null) { return b; } else { if (b == null) { return a; } final var array = Arrays.copyOf(a, a.length + b.length); System.arraycopy(b, 0, array, a.length, b.length); return array; } }  static T[] join(T[] a, T[] b);  }