Skip to content

Commit b0cc6cf

Browse files
committed
去掉没必要的循环
1 parent 0665d30 commit b0cc6cf

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/main/java/com/crossoverjie/actual/ReadFile.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,14 @@ private static void sortAndFindKeyWords(File file) throws IOException {
7171
}
7272
}
7373

74-
List<SortString> sorts = new ArrayList<>() ;
7574
for (String key :countMap.keySet()){
7675
SortString sort = new SortString() ;
7776
sort.setKey(key);
7877
sort.setCount(countMap.get(key));
79-
sorts.add(sort) ;
80-
}
8178

82-
for (SortString sortString : sorts) {
83-
contentSet.add(sortString) ;
79+
contentSet.add(sort) ;
8480
}
81+
8582
}
8683

8784
private static class SortString implements Comparable<SortString>{

0 commit comments

Comments
 (0)