Collection.plus operator is not optimal


#1

Why a plus operator creates every single time new instance of ArrayList? When I use method add() from ArrayList, the data inside is copying only if array inside is insufficient. Isn’t it a bug?


#2

nobody is expecting side effects in operators.

imagine writing something like std:cout << “asd”; thats horrible :smiley:


#3

btw there is += for mutable collections which does what you want