日期:2014-05-20  浏览次数:21167 次

比较二个List,将不同的数据作为一个新的List返回
比较二个List,结果要返回第一个里面没有的数据。

二个List里面装的都是String类型的

将不同的值做为一个新的List返回



------解决方案--------------------
public static List<String> compareTwoList(List<String> oldList,
List<String> newList) {
List<String> otherList = new ArrayList<String>();
otherList.addAll(newList);
otherList.removeAll(oldList);
return otherList;
}