Part1特征
1 不可变,不可赋值更改列表元素
2 递归结构,如链表
3 同质的,所有元素类型相同
4 协变,S是T的子类型,那么List[S]是List[T]的子类型
5 空列表的类型是List[Nothing],Nothing是所有Scala类型的子类
Part2构造
1 基础块 Nil和:: 空列表+中缀操作符
val nums = 1 :: (2 :: (3 :: (4 :: Nil)))
Part3基本操作
1 head tail isEmpty
tail:除了第一个元素之外的所有元素
Part4一阶方法
1 连接列表 :::
2 分而治之递归方法
3 长度 length
4 与head/tail相对的last/init
5 反转列表 reverse
6 获取部分列表take drop splitAt
7 apply下标索引获取元素 indices获取索引
8 zip 两个列表组成一个列表
9 显示列表 toString mkString
mkString四个操作元,mkString(pre, sep, post)
10 转换列表
elements 获取迭代器
toArray
copyToArray 拷贝到指定位置
Part5高阶方法
1 映射 map flatMap foreach
2 过滤 filter partition find takeWhile dropWhile span
3 论断 forall exists
4 折叠 /: :\
5 排序 sort
Part6 List对象的方法
1 List.apply
2 List.range
3 List.fill
4 List.unzip
5 连接列表 List.flatten, List.concat
6 List.map2 List.forall2 List.exists2