26 Mutable Collections
Scala “encourages” using immutable collections (hence they are those used by default) however sometimes mutable collections might have some benefits, either for CPU / memory performance, for code readability or simply a matter of preference. As we saw earlier, Scala provides concrete mutable collections in scala.collections.mutable
- Best practice suggests that you prefix mutable collections with 
mutable, this might not seem useful forArrayBuffer, but it will forscala.collections.mutable.Map ArrayBufferis the more or less equivalent to java’sjava.util.ArrayListwhich is backed by an arrayListBufferis the mutable partner for scala’s immutableList, implemented as a Linked List- There are many other mutable collections types, see links below for more information