Scala中Curring实战详解之Scala学习笔记-16

package com.leegh.function

/**
* @author Guohui Li
*/
object Curring {
def main(args: Array[String]): Unit = {
def muliple(x: Int, y: Int) = x * y
def multipleOne(x: Int) = (y: Int) => x * y
println(multipleOne(6)(7))

def curring(x: Int)(y: Int) = x * y
println(curring(10)(10))

val a = Array("Hello", "Spark")
val b = Array("hello", "spark")
println(a.corresponds(b)(_.equalsIgnoreCase(_)))
}
}

附:

本博客说明:

1.整理思路,提高自己。

2.受教于王家林老师,?有所收获,故推荐。

3.博客注重实践,多余的文字就不多说了,都是做技术的。

4.信息来源于 DT大数据梦工厂微信公众账号:DT_Spark。?

DT大数据梦工厂的微信公众号是DT_Spark,每天都会有大数据实战视频发布,请您持续学习。

Scala 深入浅出实战经典(1-64讲)完整视频、PPT、代码下载:

百度云盘:http://pan.baidu.com/s/1c0noOt6
腾讯微云:http://url.cn/TnGbdC
360云盘:http://yunpan.cn/cQ4c2UALDjSKy 访问密码 45e2

时间: 2024-08-13 15:40:45

Scala中Curring实战详解之Scala学习笔记-16的相关文章

DT梦工厂 第25课 Scala中curring实战详解

王家林亲授<DT大数据梦工厂>大数据实战视频 Scala 深入浅出实战经典(1-87讲)完整视频.PPT.代码下载:百度云盘:http://pan.baidu.com/s/1c0noOt6 腾讯微云:http://url.cn/TnGbdC 360云盘:http://yunpan.cn/cQ4c2UALDjSKy 访问密码 45e2土豆:http://www.tudou.com/programs/view/dHz5JKJxurM/优酷:http://v.youku.com/v_show/id_

Scala中的特质详解

Scala中的特质与Java中的接口是比较类似的,但是Scala中的特质可以同时拥有抽象方法和具体方法,而类可以实现多个特质.下面我们详细讲解Scala中的特质这个强大的功能. 1. 把特质当作接口使用 我们定义一个trait,如下所示: 1 trait Logger { 2 def log(msg: String) 3 } 需要注意的是trait中未被实现的方法默认是抽象方法,因此不需要在方法前加abstract. 子类ConsoleLogger对Logger的实现,如下所示: 1 class

Scala中复合类型实战详解之Scala学习笔记-44

package com.leegh.parameterization import com.leegh.parameterization.Compound_Type /** * @author Guohui Li */ trait Compound_Type1;trait Compound_Type2;class Compound_Type extends Compound_Type1 with Compound_Type2object Compound_Type { def compound_

Scala中结构类型实战详解之Scala学习笔记-43

package com.leegh.parameterization /** * @author Guohui Li */ class Structural { def open() = print("A class instance Opened") } object Structural_Type { def main(args: Array[String]): Unit = { init(new { def open() = println("Opened")

Scala中路径依赖代码实战详解之Scala学习笔记-42

package com.leegh.parameterization /** * @author Guohui Li */ class Outer { private val x = 10 class Inner { private val y = x + 10 }} object Path_Dependence { def main(args: Array[String]): Unit = { val outer = new Outer val inner = new outer.Inner

Scala中Dependency Injection实战详解之Scala学习笔记-47

package com.leegh.parameterization /** * @author Guohui Li */ trait Logger { def log(msg: String) }trait Auth { auth: Logger => def act(msg: String) { log(msg) }} object DI extends Auth with Logger { override def log(msg: String) = println(msg)} obje

Scala中Abstract Types实战详解之Scala学习笔记-48

package com.leegh.parameterization import scala.io.BufferedSourceimport scala.io.Source /** * @author Guohui Li */trait Reader { type In <: java.io.Serializable type Contents def read(in: In): Contents}class FileReader extends Reader { type In = Stri

Scala中Self Types实战详解之Scala学习笔记-46

package com.leegh.parameterization /** * @author Guohui Li */class Self { self => val tmp = "Scala" def foo = self.tmp + this.tmp}trait S1class S2 { this: S1 => }class S3 extends S2 with S1 trait T { this: S1 => }object S4 extends T wit

Scala中SAM转换实战详解之Scala学习笔记-15

package com.leegh.function import javax.swing.JFrameimport javax.swing.JButtonimport java.awt.event.ActionListenerimport java.awt.event.ActionEvent /** * @author Guohui Li */object SAM_Curring { def main(args: Array[String]): Unit = { var data = 0; v