【发布时间】:2017-10-08 06:44:29
【问题描述】:
列表重复了许多相同的值,我想删除它们。也许有人会检查哪里出了问题或提供一种新的方法来做到这一点?
class Duplicats implements Comparator {
public int compare(Object obj1, Object obj2) {
HashMap<String, String> test1 = (HashMap<String, String>) obj1;
HashMap<String, String> test2 = (HashMap<String, String>) obj2;
if(test1.get("name").equalsIgnoreCase(test2.get("name"))){
return 0;
}
return 1;
}
}
【问题讨论】: