Refer to this article:
https://my.oschina.net/u/1034176/blog/512314
1. In Scala 2.7, arrays and lists cannot be mixed, only tuple can be, whereas in Scala, the elements of 3 can mix different types (into any type), except when using mixed types, array and list will element type into any type, and the tuple retains the initial type of each element.
2. Variability
3. About initialization
Array
New // Array (null, NULL, NULL) is equivalent to an empty element that declares 3 null values Val Array //
= Array[any] (1, 2)
Or
Val Aa:array[any] = Array (1, 2)
Or
Val Aa:array[_] = Array (1, 2)
List
// or Val list = list (1,3,4,5,6) (:::) implements the overlay list, (::) Cons: Combines the new elements into the front of the list.
Elements are combined using::, collection Merge using:::, examples are as follows:
// Nil is a must. = List2:::list3
Tuple
Tuples are immutable, but tuples can be of different types of data, instantiated: var a = (,), can be by dot, underscore,-= (3.14159, "str",println (tuple._1) println ( tuple._2) println (tuple._3)
Todo: The blog where this article is located can be seen, or there are a lot of interesting content:
Https://my.oschina.net/u/1034176/blog
"Todo" "reprint" Scala in the difference between array, list, tuple