Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why don't scala collections have any human-readable methods like .append, .push, etc

Scala collections have a bunch of readable and almost readable operators like :+ and +:, but why aren't there any human readable synonyms like append?

like image 639
F0RR Avatar asked Dec 02 '22 01:12

F0RR


1 Answers

All mutable collections in Scala have the BufferLike trait and it defines an append method.

Immutable collections do not have the BufferLike trait and hence only define the other methods that do not change the collection in place but generate a new one.

like image 141
Maurício Linhares Avatar answered Dec 18 '22 11:12

Maurício Linhares