Simplify use of Reactor's cast operator

This commit replaces filter(x -> x instanceof C).cast(C.class) with the
built-in ofType(C.class).

See gh-32141
This commit is contained in:
Kai Zander
2024-01-27 11:18:50 +01:00
committed by Stéphane Nicoll
parent ad7c090f4c
commit d96a63944c
2 changed files with 2 additions and 4 deletions

View File

@@ -168,8 +168,7 @@ public class PartEventHttpMessageReader extends LoggingCodecSupport implements H
HttpHeaders headers = headersToken.headers();
Flux<MultipartParser.BodyToken> bodyTokens =
flux.filter(t -> t instanceof MultipartParser.BodyToken)
.cast(MultipartParser.BodyToken.class);
flux.ofType(MultipartParser.BodyToken.class);
return createEvents(headers, bodyTokens);
}
else {