List通过HashSet去重
//JAVA中
//使用hashset去重复,set为重复的集合,可以通过new ArrayList(set)转换成list HashSet<HashMap<String, String>> set = new HashSet<>();
for(HashMap<String, String> student : list) {
boolean add = set.add(student);
if (!add){
//add=false 代表数据重复
}
}
//简单写法
HashSet<HashMap<String, String>> set = new HashSet<HashMap<String, String>>(list);
List<HashMap<String, String>> List_1=new ArrayList<HashMap<String, String>>(set);