Skip to content

Commit

Permalink
use idiomatic streaming for getRoutesForPathWithPlaceholderMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Haehnchen committed Apr 20, 2024
1 parent 8e4684d commit 512a8b1
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,17 @@ public static PsiElement[] getMethodsForPathWithPlaceholderMatch(@NotNull Projec
*/
@NotNull
public static Collection<Route> getRoutesForPathWithPlaceholderMatch(@NotNull Project project, @NotNull String searchPath) {
Collection<Route> targets = new ArrayList<>();

RouteHelper.getAllRoutes(project).values()
return new ArrayList<>(RouteHelper.getAllRoutes(project).values())
.parallelStream()
.forEach(route -> {
if (route != null && isReverseRoutePatternMatch(route, searchPath)) {
targets.add(route);
.filter(Objects::nonNull)
.map(route -> {
if (isReverseRoutePatternMatch(route, searchPath)) {
return route;
}
});

return targets;
return null;
})
.filter(Objects::nonNull)
.collect(Collectors.toList());
}

/**
Expand Down

0 comments on commit 512a8b1

Please sign in to comment.