合并两个数组的内容并返回结果。
/** 来 自 时代Java公众号 - N o w J a v a . c o m **/ //package com.nowjava; import java.lang.reflect.Array; public class Main { /** * Combine the contents of two arrays and return the result. Array B will be appended onto array A * @param a The first array * @param b The second array * @param <T> The types of these arrays * @return An array with the contents of both A and B */ public static <T> T[] combine(T[] a, T[] b) { int aLen = a.length; int bLen = b.length; @SuppressWarnings("unchecked") T[] c = (T[]) Array.newInstance(a.getClass().getComponentType(), aLen + bLen);