Skip to content

Commit

Permalink
Address minor comments in BrainLogParser
Browse files Browse the repository at this point in the history
Signed-off-by: Songkan Tang <[email protected]>
  • Loading branch information
songkant-aws committed Jan 15, 2025
1 parent 51c3378 commit 43b46a5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void processTokenHistogram(List<String> tokens) {
// Ignore last element since it's designed to be appended logId
for (int i = 0; i < tokens.size() - 1; i++) {
String tokenKey = String.format(Locale.ROOT, POSITIONED_TOKEN_KEY_FORMAT, i, tokens.get(i));
tokenFreqMap.put(tokenKey, tokenFreqMap.getOrDefault(tokenKey, 0L) + 1);
tokenFreqMap.compute(tokenKey, (k, v) -> v == null ? 1 : v + 1);
}
}

Expand Down Expand Up @@ -291,7 +291,7 @@ private Map<Long, Integer> getWordOccurrences(List<String> tokens) {
for (int i = 0; i < tokens.size() - 1; i++) {
String tokenKey = String.format(Locale.ROOT, POSITIONED_TOKEN_KEY_FORMAT, i, tokens.get(i));
Long tokenFreq = tokenFreqMap.get(tokenKey);
occurrences.put(tokenFreq, occurrences.getOrDefault(tokenFreq, 0) + 1);
occurrences.compute(tokenFreq, (k, v) -> v == null ? 1 : v + 1);
}
return occurrences;
}
Expand Down

0 comments on commit 43b46a5

Please sign in to comment.