List<A>和List<B>,A/B中均沒有重複的,現在保證A/B合併爲C,且C中沒有重複的。
參考http://blog.csdn.net/secondjanuary/article/details/8599108
A.removeAll(B)
A.addAll(B)
(此處建議處理A爲空的情況)
一個同事的建議
Set<Long> C = new HashSet<>();
C.addAll(A);
C.addAll(B);
new ArrayList<Long>(C);//set轉list