Why is there a lack of consistency between collections and lists in the Scala Collection API?
For example, there is an immutable Set, but also mutable. If I want to use the latter, I can simply do this:
val set = Set[A]()
set += new A
However, there is no modified list as such. If I want to write a similar piece of code using lists, what data structure should I use? LinkedList sounds like a good candidate because it is modified, but does not have a + = method. ListBuffer seems to satisfy the requirements, but it is not a list.
After reading 2.8 Collection Documents, I came to the conclusion that the MutableList is perhaps the best fit.
I still regret somehow that was scala.collection.mutable.List.
source
share