Skip to content

Commit

Permalink
Use loop in J.Modifier#hasModifier() utility
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Jul 12, 2024
1 parent 110ea26 commit 92a2ba6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rewrite-java/src/main/java/org/openrewrite/java/tree/J.java
Original file line number Diff line number Diff line change
Expand Up @@ -4026,7 +4026,12 @@ public MethodInvocation withArguments(JContainer<Expression> arguments) {
@Data
final class Modifier implements J {
public static boolean hasModifier(Collection<Modifier> modifiers, Modifier.Type modifier) {
return modifiers.stream().anyMatch(m -> m.getType() == modifier);
for (Modifier m : modifiers) {
if (m.getType() == modifier) {
return true;
}
}
return false;
}

@With
Expand Down

0 comments on commit 92a2ba6

Please sign in to comment.