一.List字面量 List 是 Scala 中非常重要的一个数据结构,其与 Array(数组) 非常类似,但是 List 是不可变的,和 Java 中的 List 一样,其底层实现是链表. scala> val list = List("hadoop", "spark", "storm") list: List[String] = List(hadoop, spark, storm) // List 是不可变 scala> list
1. Unified Type System Scala has a unified type system, enclosed by the type Any at the top of the hierarchy and the type Nothing at the bottom of the hierarchy. All Scala types inherit from Any. # Using Any, Book extends AnyRef, and x is an Int that
1.Scala中提供了一种数据结构-数组,其中存储相同类型的元素的固定大小的连续集合.数组用于存储数据的集合,但它往往是更加有用认为数组作为相同类型的变量的集合 2 声明数组变量: 要使用的程序的数组,必须声明一个变量来引用数组,必须指定数组变量可以引用的类型.下面是语法声明数组变量: var z:Array[String] = new Array[String](3) or var z = new Array[String](3) or var z = Array("Zara", &