去重复记录

Set<Category>tempSet=new HashSet<Category>(baseCategoryList);
Category[] temp=tempSet.toArray(new Category[tempSet.size()]);
baseCategoryList=Arrays.asList(temp);
List baseList=new ArrayList();

public boolean equals(Object o) {
AttributeItemBean s = (AttributeItemBean) o;
if (s.getName().equals(name) && s.getAttrId().equals(attrId)) {
return true;
} else {
return false;
}
}

public int hashCode() {
int result = 17;
result = 37 * result + name.hashCode();
result = 37 * result + attrId.intValue();
return result;
}



private void populateAvailableAttributeGroups(){
availableAttributeGroups = new ArrayList<AttributeGroupBean>(allAttributeGroups);
if(!selectedAttributeGroups.isEmpty()){
availableAttributeGroups.removeAll(selectedAttributeGroups);
}
}

你可能感兴趣的:(去重)