Returns a new array that contains the concatenated contents of two arrays. @param first the first array of elements to concatenate @param second the second array of elements to concatenate @param type the component type of the returned array
(
T[] first, T[] second, Class<@NonNull T> type)
| 76 | * @param type the component type of the returned array |
| 77 | */ |
| 78 | @GwtIncompatible // Array.newInstance(Class, int) |
| 79 | public static <T extends @Nullable Object> T[] concat( |
| 80 | T[] first, T[] second, Class<@NonNull T> type) { |
| 81 | T[] result = newArray(type, first.length + second.length); |
| 82 | arraycopy(first, 0, result, 0, first.length); |
| 83 | arraycopy(second, 0, result, first.length, second.length); |
| 84 | return result; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Returns a new array that prepends {@code element} to {@code array}. |