Repository navigation
MINOR: Use Stream.toList() for internal lists - #3926
Merged
Merged
Conversation
wgtmac
approved these changes
Nov 3, 2026
Fokko
approved these changes
Nov 3, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is quite minor and I took a conservative approach.
Stream.toList()returns an unmodifiable list unlikecollect(Collectors.toList())so a wholesale search and replace is dangerous. These changes all seem quite safe though.Codex generated summary below and I stand by it.
Rationale for this change
With the Java 17 baseline, internal lists that are only read after construction can use
Stream.toList(). This shortens stream expressions and makes their read-only use explicit.What changes are included in this PR?
Replace seven
collect(Collectors.toList())calls acrossReflectClassValidator,FilteringRecordMaterializer,ParquetFileReader, andParquetRewriter, and remove unused imports. The selected lists hold private validation prefixes, lookup-map keys, directory listings, and temporary logging, metadata, and row-count results.Are these changes tested?
Validated in the Java 17 developer Docker image:
Are there any user-facing changes?
No. The changed lists are internal and are not modified after construction. Publicly returned lists and lists passed to Hadoop implementations retain their existing behavior.