List去重复方法

Map<Long, ProjectContract> map=new LinkedHashMap<Long, ProjectContract>();   
  
for(ProjectContract pcontract:projectContracts){    
   if(!map.containsKey(pcontract.getId())){
       map.put(pcontract.getId(), pcontract);   
   }                       
}   
  
return Arrays.asList(map.values().toArray());  

 

你可能感兴趣的:(list)