|
本帖最后由 holilz 于 2020-10-26 19:07 编辑
如何批量删除Alist包含的Blist的数据
如:alist里有A、B、C,Blist里有A,B
怎么在alist只保留C。- 去掉一个list中包含的另一个list数据,高效写法
- LinkedList<Question> veirfyingList = questionService.getVeirfying(cityCode);
- LinkedList<Question> verifiedList = questionService.getVerifiedQuestion(uid, cityCode);
- HashSet h1 = new HashSet(veirfyingList);
- HashSet h2 = new HashSet(verifiedList);
- h1.removeAll(h2);
- veirfyingList.clear();
- veirfyingList.addAll(h1)
复制代码 谁帮忙转成火车头里的c#插件
|
|