随笔分类 - Scala
empty to full
摘要:1. 概述 ScalaTest是scala生态系统中最流行和灵活的测试工具,可以测试scala、js、java代码。 2. ScalaTest的特性 a. ScalaTest的核心是套件(suite),即0到多个测试的集合b. 测试可以是含有一个名称的任意内容,该名称可以用来启动、待处理或取消,也可
阅读全文
摘要:1. Translating Java Classes to Scala Classes Example 1: Example 2: Example 3: Example 4: Example 5: Translating Java imports to Scala imports: Example
阅读全文
摘要:1. Unified Type System Scala has a unified type system, enclosed by the type Any at the top of the hierarchy and the type Nothing at the bottom of the
阅读全文
摘要:A trait provides code reusability in Scala by encapsulating method and state and then offing possibility of mixing them into classes thus allowing cod
阅读全文
摘要:Scala's object-oriented collections support mutable and immutable type hierarchies. Also support functional higher-order operations such as map, filte
阅读全文
摘要:The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters and pattern matching. 1. Basic Pattern Matching I
阅读全文
摘要:1. Functional programming treats computation as the evaluation of mathematical and avoids state and mutable data. Scala encourages an expression-orien
阅读全文
摘要:1. The three principles of OOP are encapsulation(封装性), inheritance(继承性) and polymorphism(多态性). example: A subtype is guaranteed to have all the member
阅读全文
摘要:1. Variables (1) Three ways to define variables: 1) val refers to define an immutable variable; 2) var refers to define a mutable variable. 3) lazy va
阅读全文
摘要:1. Scala is a contraction of "scalable" and "language". It's a fusion of objected-oritended and functional programming. 2. Compare Book class between
阅读全文