=> has several meanings in Scala, all related to its mathematical meaning as implication. 1. In a value, it introduces a function literal, or lambda. e.g. the bit inside the curly braces inList(1,2,3).map { (x: Int) => x * 2 } 2. In a type, with sym…
Scala中的 apply 方法有着不同的含义, 对于函数来说该方法意味着调用function本身, 以下说明摘自Programming in Scala, 3rd Edition Every function value is an instance of some class that extends one of several FunctionN traits in package scala, such as Function0 for functions with no parame…
本文旨在介绍Scala在其他语言中不太常见的符号含义,帮助理解Scala Code. 随着我对Scala学习的深入,我会不断增加该篇博文的内容. 修改记录 ----2016.11.23 新增scala中最神秘强大的下划线(_)用处 下面介绍Scala中的符号: :::三个冒号运算符:表示list的连接操作 val one = List(1,2,3) val two = List(4,5,6) val three = one:::two 输出结果为:three: List[Int] = List…