Closed MariusVolkhart closed 6 months ago
Comment from Brian Goetz on some details. IIRC, Mark Stuart also had a presentation about it when talking about the Collections API, but I can't find it. :) https://stackoverflow.com/a/65981428/2502247
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
0c83398
) 91.20% compared to head (2bee4d7
) 91.14%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I think the main difference is that collect(Collectors.toList())
currently returns a mutable ArrayList
(but this could change anytime in future Java versions) and toList()
returns an immutable list.
This change could potentially break user code for these public methods:
public List<String> generateAll()
public List<String> precompileAll()
public List<String> precompile(List<String> names)
If users attempt to modify the returned lists. Most regular users of the lib don't call these, so it shouldn't be a problem. We should still add a comment to the patch notes though.
toList was added in Java 16, and some streams can perform a more optimized operation compared to Collectors.toList().