用hashset反向判断;相同是没有不相同则有相同字段:hashset不能有相同数据
HashSet<String> uidSet = new HashSet<>();
customerAttributesTextOptionalAddParamList.stream().forEach(t->{
uidSet.add(t.getAttrSelectMark());
});
本文介绍了一种利用HashSet的数据结构特性来判断集合中是否存在重复数据的方法。通过将待检查的元素逐一添加到HashSet中,如果添加失败,则表明存在重复项。
用hashset反向判断;相同是没有不相同则有相同字段:hashset不能有相同数据
HashSet<String> uidSet = new HashSet<>();
customerAttributesTextOptionalAddParamList.stream().forEach(t->{
uidSet.add(t.getAttrSelectMark());
});
220

被折叠的 条评论
为什么被折叠?