Scala并发编程实战初体验及其在Spark源码中的应用解析之Scala学习笔记-56
摘要:package com.leegh.actorimport scala.actors.Actor/** * @author Guohui Li */object First_Actor extends Actor { def act() { for (i <- 1 to 10) { ...
阅读全文
posted @
2015-09-18 21:43
李格非
阅读(174)
推荐(0)
Scala中隐式转换内幕操作规则揭秘、最佳实践及其在Spark中的应用源码解析之Scala学习笔记-55
摘要:package com.leegh.implicitsimport scala.io.Sourceimport java.io.File/** * @author Guohui Li */class RicherFile(val file: File) { def read = Source.fr...
阅读全文
posted @
2015-09-17 08:51
李格非
阅读(155)
推荐(0)
Scala中隐式对象代码实战详解之Scala学习笔记-54
摘要:package com.leegh.implicits/** * @Tuthor Guohui Li */abstract class Template[T] { def add(x: T, y: T): T}abstract class SubTemplate[T] extends Templa...
阅读全文
posted @
2015-09-16 08:21
李格非
阅读(150)
推荐(0)
Scala中隐式类代码实战详解之Scala学习笔记-53
摘要:package com.leegh.implicitsimport java.io.Fileimport scala.io.Source/** * @author Guohui Li */object Context_Helper { implicit class FileEnhance(file...
阅读全文
posted @
2015-09-15 10:32
李格非
阅读(115)
推荐(0)
Scala中上下文界定内幕中的隐式参数与隐式参数的实战详解及其在Spark中的应用源码解析之Scala学习笔记-52
摘要:package com.leegh.implicits/** * @author Guohui Li *///类型参数可以有一个形式为T:M的上下文界定,其中M是另一个泛型类型。它要求作用域中存在一个类型为M[T]的隐式值class Pair_Implicits[T: Ordering](val f...
阅读全文
posted @
2015-09-14 08:14
李格非
阅读(174)
推荐(0)
Scala中隐式参数与隐式转换的联合使用实战详解及其在Spark中的应用源码解析之Scala学习笔记-51
摘要:package com.leegh.implicits/** * @author Guohui Li */object Implicit_Conversions_with_Implicit_Parameters { def main(args: Array[String]): Unit = { ...
阅读全文
posted @
2015-09-13 09:29
李格非
阅读(106)
推荐(0)
Scala中隐式参数实战详解以及隐式参数在Spark中的应用源码解析之Scala学习笔记-50
摘要:package com.leegh.implicits/** * @author Guohui Li */object Context_Implicits { implicit val default: String = "java"}object Param { def print(conte...
阅读全文
posted @
2015-09-12 11:12
李格非
阅读(205)
推荐(0)
Scala中隐式转换初体验实战详解以及隐式转换在Spark中的应用源码解析之Scala学习笔记-49
摘要:package com.leegh.implicitsimport scala.io.Sourceimport java.io.File/** * @author Guohui Li */class RichFile(val file: File) { def read = Source.from...
阅读全文
posted @
2015-09-11 19:29
李格非
阅读(248)
推荐(0)
Scala中Abstract Types实战详解之Scala学习笔记-48
摘要:package com.leegh.parameterizationimport scala.io.BufferedSourceimport scala.io.Source/** * @author Guohui Li */trait Reader { type In <: java.io.Ser...
阅读全文
posted @
2015-09-10 09:19
李格非
阅读(182)
推荐(0)
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) {...
阅读全文
posted @
2015-09-09 17:35
李格非
阅读(182)
推荐(0)
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 {...
阅读全文
posted @
2015-09-08 09:01
李格非
阅读(239)
推荐(0)
Scala中Infix Type实战详解之Scala学习笔记-45
摘要:package com.leegh.parameterization/** * @author Guohui Li */object Infix_Types { def main(args: Array[String]): Unit = { object Log { def >>:(data...
阅读全文
posted @
2015-09-07 14:44
李格非
阅读(144)
推荐(0)
Scala中复合类型实战详解之Scala学习笔记-44
摘要:package com.leegh.parameterizationimport com.leegh.parameterization.Compound_Type/** * @author Guohui Li */trait Compound_Type1;trait Compound_Type2;c...
阅读全文
posted @
2015-09-06 07:44
李格非
阅读(130)
推荐(0)
Scala中结构类型实战详解之Scala学习笔记-43
摘要:package com.leegh.parameterization/** * @author Guohui Li */class Structural { def open() = print("A class instance Opened") }object Structural_Type {...
阅读全文
posted @
2015-09-05 09:00
李格非
阅读(135)
推荐(0)
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_...
阅读全文
posted @
2015-09-04 08:36
李格非
阅读(141)
推荐(0)
Scala中链式调用风格的实现代码实战及其在Spark编程中的广泛运用之Scala学习笔记-41
摘要:package com.leegh.parameterization/** * @author Guohui Li *///由于breathe返回的是this,scala将返回类型推断为Animal,而由于Animal没有eat方法//class Animal { def breathe = thi...
阅读全文
posted @
2015-09-03 13:30
李格非
阅读(154)
推荐(0)
Scala中Variance代码实战及其在Spark中的应用源码解析之Scala学习笔记-40
摘要:package com.leegh.parameterization/** * @author Guohui Li */class Personclass Student extends Personclass C[+T](val args: T)trait Friend[-T] { def ma...
阅读全文
posted @
2015-09-02 08:55
李格非
阅读(142)
推荐(0)
Scala类型约束代码实战及其在Spark中的应用源码解析之Scala学习笔记-39
摘要:package com.leegh.parameterization/** * @author Guohui Li */object Type_Contraints { def main(args: Array[String]): Unit = { def rocky[T](i: T)(im...
阅读全文
posted @
2015-09-01 08:54
李格非
阅读(151)
推荐(0)