Skip to content

Commit

Permalink
refactor: fix sonarqube issues in Pattern.java (#6172)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishivijayv authored Feb 6, 2025
1 parent ce5be10 commit 092d610
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/spoon/pattern/Pattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void forEachMatch(Object input, CtConsumer<Match> consumer) {
if (input instanceof Collection<?>) {
scanner.scan(null, (Collection<CtElement>) input);
} else if (input instanceof Map) {
scanner.scan(null, (Map<String, ?>) input);
scanner.scan(null, input);
} else {
scanner.scan(null, (CtElement) input);
}
Expand All @@ -110,9 +110,7 @@ public void forEachMatch(Object input, CtConsumer<Match> consumer) {
*/
public List<Match> getMatches(CtElement root) {
List<Match> matches = new ArrayList<>();
forEachMatch(root, match -> {
matches.add(match);
});
forEachMatch(root, matches::add);
return matches;
}

Expand Down

0 comments on commit 092d610

Please sign in to comment.