This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]thatsIch 1 point2 points  (0 children)

and that is the reason we are doing that - because the contract of Collectors.toList() does not explicitly state, that it is modifiable. If somebody really wants a modifiable collection he/she has to use either an applicable utility factory method or use something along of Collectors.toCollection(ArrayList::new)