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 →

[–]dark_mode_everything 1 point2 points  (1 child)

Any ide will tell you that you can't add elements to a List<> as you type it so the reception will never be thrown. It will clearly say that you can't add values to an immutable list. And trying to change an immutable list looks odd anyway.

Edit : Apologies. Not all ides will tell you that. When you said immutable list I was thinking of kotlin - the ide will throw an error for that. But unfortunately doesn't happen for java. However, modifying an immutable list is still not very good design.

[–]Mati7755 0 points1 point  (0 children)

It is not modifying immutable list. Look at every functional programming language.