|
@@ -48,11 +48,11 @@ public class DeDuplicationStrategy implements FilterStrategy {
|
|
|
List<Content> contents = contentMap.get(contentPool);
|
|
|
Future<List<Content>> future = pool.submit(() -> {
|
|
|
try {
|
|
|
- List<Content> res = new ArrayList<>();
|
|
|
- Set<String> titles = new HashSet<>();
|
|
|
if (CollectionUtils.isEmpty(contents)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
+ List<Content> res = new ArrayList<>(contents.size());
|
|
|
+ Set<String> titles = new HashSet<>(contents.size());
|
|
|
for (Content c : contents) {
|
|
|
if (titles.contains(c.getTitle())) {
|
|
|
c.setFilterReason("重复文章");
|
|
@@ -87,8 +87,8 @@ public class DeDuplicationStrategy implements FilterStrategy {
|
|
|
}
|
|
|
|
|
|
private List<String> groupDeduplication(List<Content> contentList, List<Content> filterContents) {
|
|
|
- List<String> result = new ArrayList<>();
|
|
|
- Set<String> titles = new HashSet<>();
|
|
|
+ List<String> result = new ArrayList<>(contentList.size());
|
|
|
+ Set<String> titles = new HashSet<>(contentList.size());
|
|
|
Map<String, List<Content>> contentMap = contentList.stream().collect(Collectors.groupingBy(Content::getContentPoolType));
|
|
|
|
|
|
List<String> contentPoolList = ContentPoolEnum.getOrderContentPool();
|