去掉一个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);

 


版权声明:本文为z394642048原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。