public static <T> List<T> compare(T[] t1, T[] t2) {
List<T> list1 = Arrays.asList(t1);
List<T> list2 = new ArrayList<T>();
for (T t : t2) {
if (!list1.contains(t)) {
list2.add(t);
}
}
return list2;
}
compare(new Integer[] { 1, 2, 3 }, new Integer[] {
1, 2, 3, 4 })
参考:http://zhidao.baidu.com/question/308246903.html