dossett commented on code in PR #3378:
URL: https://github.com/apache/parquet-java/pull/3378#discussion_r2733449626


##########
parquet-thrift/src/main/java/org/apache/parquet/thrift/struct/ThriftType.java:
##########
@@ -502,12 +502,7 @@ public EnumType(@JsonProperty("values") List<EnumValue> 
values) {
     }
 
     public Iterable<EnumValue> getValues() {
-      return new Iterable<EnumValue>() {
-        @Override
-        public Iterator<EnumValue> iterator() {
-          return values.iterator();
-        }
-      };
+      return List.copyOf(values);

Review Comment:
   We could also make `private final List<EnumValue> values;` a 
`unmodifiableList` from the start and just directly return that in getValues(). 
 Although maybe that's technically a breaking change if [someone was 
relying](https://www.hyrumslaw.com/) on being able to indirectly update the 
list.
   
   Or the simplest change to keep current behavior but express it in a Java 11 
idiom would be `return () -> values.iterator();`
   
   I'm ok with any of these options!



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to