Skip to content

MINOR: Use Stream.toList() for internal lists - #3926

Merged
Fokko merged 1 commit into
apache:masterfrom
dossett:stream-to-list-validator
Nov 3, 2026
Merged

Fokko merged 1 commit into
apache:masterfrom
dossett:stream-to-list-validator

Conversation

@dossett

@dossett dossett commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

This is quite minor and I took a conservative approach. Stream.toList() returns an unmodifiable list unlike collect(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 across ReflectClassValidator, FilteringRecordMaterializer, ParquetFileReader, and ParquetRewriter, 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:

  • Nine existing Avro string-behavior and reflection read/write tests.
  • 37 existing record-level filtering, rewrite/join, and footer metadata tests.
  • Affected reactor builds and Spotless checks passed.

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.

@Fokko
Fokko merged commit 3683beb into apache:master Nov 3, 2026
5 checks passed
@Fokko

Fokko commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for the clean-up @dossett, much appreciated. Thanks @wgtmac for the prompt review 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants