标签:moved mapper sam array set new 一个 tor duplicate
//普通集合List去重方法 public List<floorMapper> removethesame(List<floorMapper> list) { //创建一个临时集合装去重后的数据 List<floorMapper> tempList = new ArrayList<floorMapper>(); for (floorMapper i : list) { if (!tempList.contains(i)) {//判断是否有重复数据,如果没有就将数据装进临时集合 tempList.add(i); } } return tempList; } //根据Java中集合中根据对象的某个属性去重 private static List<floorMapper> removeDuplicateFlight(List<floorMapper> flights) { Set<floorMapper> set = new TreeSet<floorMapper>(new Comparator<floorMapper>() { @Override public int compare(floorMapper o1, floorMapper o2) { //字符串,则按照asicc码升序排列 return o1.getFloorid().compareTo(o2.getFloorid()); } }); set.addAll(flights); return new ArrayList<floorMapper>(set); }
标签:moved mapper sam array set new 一个 tor duplicate
原文地址:https://www.cnblogs.com/EarlyBridVic/p/12125765.html