Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The difference between array and list in Scala
The difference between array and list in Scala
List in Scala is immutable recursive data, which is a basic structure in Scala. You should use List more than Array(Array is actually variable and immutable Array is IndexedSeq).

Variable structure

ListBuffer provides a list of constant time transformations.

Scala's array should be generated by Java array, so Array[Int] may be more efficient than List[Int].

However, I think arrays in Scala should be used as little as possible, because it feels like you really need to know what's going on at the bottom before you can decide whether arrays will back up the basic data types you need, or maybe box them as wrapper types.