对于几乎所有的集合类,Scala都同时提供了可变和不可变的版本,分别位于以下两个包
不可变集合:scala.collection.immutable
可变集合: scala.collection.mutable...List(5432, 34, 23, 22, 2, 1)
sortWith[重点]
sortWith(func: (集合元素类型,集合元素类型) => Boolean )
sortWith 中的函数如果第一个参数...>第二个参数,降序
sortWith 中的函数如果第一个参数<第二个参数,升序
根据指定规则排序【指定升序或者降序】
val list2=List[(String,Int)](
("张三"...","scala","hadoop","hive")
打印输出
list.foreach(s=>println(s))
java
python
scala
hadoop
hive
filter
filter...字符串
val list4=List("hello","spark","hello","java","hello","hadoop","spark","spark","hadoop","java")