没有标准的方法对不起。您可以使用标准JDK相当轻松地完成此 *** 作,而无需诉诸于对Apache
Commons的依赖(如其他人所建议的那样)。假设您的清单是
List<T>实例:
List<T> oldList = ...List<T> newList= ...List<T> removed = new ArrayList<T>(oldList);removed.removeAll(newList);List<T> same = new ArrayList<T>(oldList);same.retainAll(newList);List<T> added = new ArrayList<T>(newList);added.removeAll(oldList);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)