gemini-code-assist[bot] commented on code in PR #37785:
URL: https://github.com/apache/beam/pull/37785#discussion_r2895349287
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextIOWriteTest.java:
##########
@@ -328,38 +328,35 @@ public void testDynamicDefaultFilenamePolicy() throws
Exception {
StreamSupport.stream(
elements.stream()
.filter(
- Predicates.compose(new StartsWith("a"), new
ExtractWriteDestination())
- ::apply)
+ Predicates.compose(new StartsWith("a"), new
ExtractWriteDestination()))
.collect(Collectors.toList())
.spliterator(),
false)
- .map(Functions.toStringFunction()::apply)
+ .map(Functions.toStringFunction())
.collect(Collectors.toList()),
Review Comment:

This stream processing logic can be simplified. The intermediate collection
to a list, getting a spliterator, and then creating a new stream via
`StreamSupport.stream` is unnecessary and less efficient than chaining the
stream operations directly. This simplification can be applied to the logic for
`bElements` and `cElements` as well.
```java
elements.stream()
.filter(
Predicates.compose(new StartsWith("a"), new
ExtractWriteDestination()))
.map(Functions.toStringFunction())
.collect(Collectors.toList()),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]