bowsii opened a new issue, #4757:
URL: https://github.com/apache/polaris/issues/4757
### Is your feature request related to a problem? Please describe.
Several locations in the codebase use stream.collect(Collectors.toList())
even when the resulting list is not modified after creation.
Since Polaris targets modern Java versions that support Stream.toList(),
these usages introduce unnecessary boilerplate and reduce consistency with
modern Java practices.
Reviewing and updating these occurrences would improve readability and
simplify stream operations while preserving existing behavior where mutability
is not required.
### Describe the solution you'd like
Review usages of Collectors.toList() across the codebase and replace them
with Stream.toList() where the returned list is not modified after creation.
Each occurrence should be evaluated individually to ensure that mutability
is not required, since Stream.toList() returns an unmodifiable list.
Example:
Before:
List<String> names =
users.stream()
.map(User::getName)
.collect(Collectors.toList());
After:
List<String> names =
users.stream()
.map(User::getName)
.toList();
Acceptance criteria:
- Safe usages of Collectors.toList() are identified.
- Replacements are made only where behavior remains unchanged.
- Existing tests continue to pass.
- No regressions related to list mutability are introduced.
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
--
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]