Here you can find the source of concat(final T[] first, final T[] second)
Parameter | Description |
---|---|
first | The first source array |
second | The second source array |
public static <T> T[] concat(final T[] first, final T[] second)
//package com.java2s; import java.util.Arrays; public class Main { /**// www . ja va 2s .c om * Merges two arrays together * * @param first The first source array * @param second The second source array * @return An array that combines the two arrays */ public static <T> T[] concat(final T[] first, final T[] second) { /* deal with null inputs */ if (first == null && second == null) return null; if (first == null) return second; if (second == null) return first; final T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } }