What is the most effective way of conversion between different scala.collection object?
E.g.
val a=scala.collection.mutable.ListBuffer(1,2,0,3)
And I want to get scala.collection.mutable.ArrayBuffer
.
According to http://docs.scala-lang.org/resources/images/collections.mutable.png it should be possible by converting to
Buffer
and toArrayBuffer
afterwards. Correct?In general, can i make any conversion in scala collection through its common ancestor? (in the previous example the common ancestor is
Buffer
)
PS I read http://docs.scala-lang.org/overviews/collections/introduction.html but couldn't find anything about general conversions between various types (i'm aware about .toArray like methods)
thx