摘要:
1 package chapter08 2 3 object Test03_MatchTupleExtend { 4 def main(args: Array[String]): Unit = { 5 // 1. 在变量声明时匹配 6 val (x, y) = (10, "hello") 7 pri 阅读全文
posted @ 2022-01-20 21:11
靠谱杨
阅读(41)
评论(0)
推荐(0)
摘要:
1 package chapter08 2 3 object Test02_MatchTypes { 4 def main(args: Array[String]): Unit = { 5 // 1. 匹配常量 6 def describeConst(x: Any): String = x matc 阅读全文
posted @ 2022-01-20 21:09
靠谱杨
阅读(47)
评论(0)
推荐(0)
摘要:
1 package chapter07 2 3 object Test18_ComplexWordCount { 4 def main(args: Array[String]): Unit = { 5 val tupleList: List[(String, Int)] = List( 6 ("he 阅读全文
posted @ 2022-01-20 20:34
靠谱杨
阅读(144)
评论(0)
推荐(0)
摘要:
1 package chapter07 2 3 object Test17_CommonWordCount { 4 def main(args: Array[String]): Unit = { 5 val stringList: List[String] = List( 6 "hello", 7 阅读全文
posted @ 2022-01-20 20:19
靠谱杨
阅读(115)
评论(0)
推荐(0)
摘要:
1 package chapter07 2 3 object Test15_HighLevelFunction_Reduce { 4 def main(args: Array[String]): Unit = { 5 val list = List(1,2,3,4) 6 7 // 1. reduce 阅读全文
posted @ 2022-01-20 16:53
靠谱杨
阅读(203)
评论(0)
推荐(0)
摘要:
1 package chapter07 2 3 object Test14_HighLevelFunction_Map { 4 def main(args: Array[String]): Unit = { 5 val list = List(1,2,3,4,5,6,7,8,9) 6 7 // 1. 阅读全文
posted @ 2022-01-20 16:37
靠谱杨
阅读(493)
评论(0)
推荐(0)