Skip to content

Commit

Permalink
use for loop instead of streams for unchecked list creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Fadelis committed Sep 8, 2023
1 parent 0bdbd29 commit 940eb5a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ public final class RequestCaptureInterceptor implements ServerInterceptor {
public <ReqT> List<CapturedRequest<ReqT>> requestsFor(@Nonnull RequestPattern<ReqT> requestPattern) {
Objects.requireNonNull(requestPattern);
List<CapturedRequest<ReqT>> matchedRequests = new ArrayList<>();
capturedRequests.stream()
.filter(requestPattern::matches)
.map(requestPattern::normalizedCapturedRequest)
.forEach(matchedRequests::add);
for (CapturedRequest capturedRequest : capturedRequests) {
if (requestPattern.matches(capturedRequest)) {
matchedRequests.add(requestPattern.normalizedCapturedRequest(capturedRequest));
}
}
return matchedRequests;
}

Expand Down

0 comments on commit 940eb5a

Please sign in to comment.