版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
/**
*
* @param list1 集合1
* @param list2 集合2
* @param <T> 数据类型
* @return
*/
private <T> boolean compareList(List<T> list1, List<T> list2) {
if (list1 == null) {
return false;
}
if (list1.size() != list2.size()) {
return false;
}
Set<Integer> hashCodeSet = new HashSet<>();
for (T adInfoData : list1) {
hashCodeSet.add(adInfoData.hashCode());
}
for (T adInfoData : list2) {
if (!hashCodeSet.contains(adInfoData.hashCode())) {
return false;
}
}
return true;
}