gemini-code-assist[bot] commented on code in PR #38405:
URL: https://github.com/apache/beam/pull/38405#discussion_r3202541449
##########
sdks/java/io/file-schema-transform/src/test/java/org/apache/beam/sdk/io/fileschematransform/FileWriteSchemaTransformFormatProviderTestData.java:
##########
@@ -60,6 +62,23 @@ class FileWriteSchemaTransformFormatProviderTestData {
/* Prevent instantiation outside this class. */
private FileWriteSchemaTransformFormatProviderTestData() {}
+ private static class ListPatcher<T> {
+ private ArrayList<T> list;
+
+ ListPatcher(List<T> list) {
+ this.list = Lists.newArrayList(list);
+ }
+
+ ArrayList<T> get() {
+ return list;
+ }
+
+ ListPatcher<T> patch(int index, T value) {
+ list.set(index, value);
+ return this;
+ }
+ }
Review Comment:

The `ListPatcher` utility class can be improved by following Java best
practices: using the `List` interface for the internal field and return types,
and marking the field as `final`. Additionally, using the standard `ArrayList`
constructor is preferred over the vendored Guava utility `Lists.newArrayList()`
to avoid unnecessary dependencies in test code.
```java
private static class ListPatcher<T> {\n private final List<T> list;\n\n
ListPatcher(List<T> list) {\n this.list = new ArrayList<>(list);\n
}\n\n List<T> get() {\n return list;\n }\n\n ListPatcher<T>
patch(int index, T value) {\n list.set(index, value);\n return
this;\n }\n }
```
##########
sdks/java/io/file-schema-transform/src/test/java/org/apache/beam/sdk/io/fileschematransform/FileWriteSchemaTransformFormatProviderTestData.java:
##########
@@ -50,6 +51,7 @@
import
org.apache.beam.sdk.io.common.SchemaAwareJavaBeans.SinglyNestedDataTypes;
import org.apache.beam.sdk.io.common.SchemaAwareJavaBeans.TimeContaining;
import org.apache.beam.sdk.values.Row;
+import
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Lists;
Review Comment:

This import is no longer needed if the `ListPatcher` class is refactored to
use the standard `ArrayList` constructor instead of the vendored Guava utility.
--
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]