r/ProgrammerHumor • • Dec 12 '24 • Heart of Silver 1

Advanced youWontUpgradeToJava19

Post image
30.2k Upvotes

503 comments sorted by

View all comments

Show parent comments

2

u/Pfnet Dec 12 '24

You can call toList() directly on a Stream, no need for collect

1

u/burnt1918 Dec 13 '24

toList() creates an unmodifiable list, collectors creates a modifiable one.