两个集合 以编码作为比较字段
List<T> first ;
List<T> second;
if(first == null || second == null || first.size() == 0 || second.size() == 0){
return false;
}
List<T> result = new ArrayList<>();
Map<String, String> listMap = new HashMap<>();
String temp;
//遍历集合
for(T t : second){
//编码
temp = String.valueOf(t.getCode());
listMap.put(temp, temp);
}
for(T t : first){
temp = String.valueOf(t.getCode());
//比较差异
if(listMap.get(temp) == null){
//添加差异信息
result.add(t);
}
}