1 Type auto-match (pattern match)
2 functions are valued (anonymous functions are the norm of functions)
Recursive functions need to specify return values
3. The inner class is subordinate to the instance of the external class itself, while the Java inner class belongs to the external class, and the dependent path dependency of the external classes
4.object all members that are similar to static classes in Java are static and apply to configuration files
5. Object with the same name is the associated object of class, and many times the associated object is a package area that is a static member of the associated class.
The last line of the 6.scala method is the return value without return
7.scala variable parameter int* in Java int ... Args
8.apply Use and single case
Http://book.51cto.com/art/201408/449448.htm
9. Interface trait (can have non-abstract methods) is much more powerful than interface (abstract method only) extends ....
As with Java, you can inherit only one trait or class, and if you want to inherit other trait, you need with (object mixed)
10. All the members and methods of the package object can be accessed directly by all classes in the Package Object pack
Implicit references to 11scala packages
Import Java.lang._
Import Scala._
Import Predef._
12. Map symbol = = lambda expression, which represents an anonymous function
13. Placeholder _ placeholder Pattern match represents string
14. Functions defined in functions by local functions, intrinsic functions are private functions, external access is not accessible, high cohesion low coupling is achieved
15. The partial function _ represents the parameter compiler to automatically generate classes according to the sum _ (space + underscore) the Apply method to pass part of the parameter into another function
16. The closure JavaScript support closure is the ability to read other function internal variables, due to the language characteristics of JavaScript, if you want to read a variable inside a function, then you must be the function of the inner sub-function.
17. Higher order function map () takes function as parameter
pattern matching and extractor extrator
Match
Case
Case
Application of pattern matching on specific data types
19. Follow the regular expression with a. r
20.Scala case class and pattern matching (pattern matching), these two two program structures are very useful for processing data in a tree structure. Scala's case class makes it easy to match objects in a pattern, and in a nutshell, Scala's class is a keyword that adds a case to the normal classes definition, and then you can pattern-match those classes.
The member defaults to Val, the member does not explicitly declare Var or val, and the default is Val (constant)
Each case class will have a companion object with the Apply method
The associated object will help us construct the specific object of case class.
Unapply extracts content from an already constructed object (case class or object), while the associated object's apply method is a Build object
The function name of the 21 constructor is this, and the overloaded constructor (the secondary constructor) must call the other subordinate constructors, and the other constructors will call the main constructor in the final form, and if the Scala function omits the parentheses, this() can be abbreviated to this
The . @ symbol can be used to reference the object to which the
The sealed closure can only be inherited within the current file, and the restricted subclass must be in the same file
Option's two subclass Some None
24. Two:: List of ways, three::-: Combination of list,list sets divided into head (first) and tail two part
25. zip Operation Zip
flatMap merging multiple collections after collection of maps
27.List more operations partition (partition) span Find (the first element that satisfies a condition) takewhile dropwhile
Exists (with a satisfied return true) ForAll (all satisfied returns True)
28.foldLeft foldright start Sortwith (_<_) sort operation from leftmost start and rightmost
List.range (2,5) semi-closed half-open interval List (2,3,4) does not include 5
30.LIST.MAP2 simultaneous manipulation of two sets of corresponding elements
31. mutable collections need to introduce mutable packages, which are immutable collections by default
Variable sets can be deleted directly with + = and-=, ++= and--= append delete the collection
32.HashMap very efficient, hashcode value of key
33.treemap,treeset the Orderly
34.LIST[+A] co-change
<-extract symbol (iterator)
Panax Notoginseng F represents the function
Bounds. Type qualifier Symbol
<: The upper bound can only be sub-class
>: The nether can only be the parent class
More commonly used <% View definition is not a subclass implicitly converts an Int->richint string->richstring
Ordered[t] objects can be substituted with the Comapreto method of the > or < symbol comparison object instead of Comparable[t]
[k:ordering] Context bounds contexts define the existence of an implicit value of type ordering
Spark is heavily used
[T:manifest] Internally automatically constructs an implicit parameter for the Manifest type implicit
[T:classtag] is automatically translated into implicit and implicit values at compile-time
Virtual runtime generic is erased, do not know generics, must give specific types
Understanding can type constraints a <: < b A must be a sub-analogy of B <: stricter, when compiled to determine the type
A=:=b A and B are the same type
43. Understanding can Variance variable or variant [+a] covariance (covariant) [-A] contravariance (inversion)
44. By default, as long as the method is generic, its arguments are contravariant and the return value is covariant
This.type represents the type of the current object (this), which refers to the current object . This.type are used for variables, function arguments, and type declarations of function return values, mainly in some cases to enforce type constraints, or to ensure absolute security of types, chained calls
The type equals an alias.
Spark seldom uses struct types to avoid restricting it from the angle of a class or interface, and the incoming parameters contain some method
48. Composite type (extend .... With ....) Used in combination with structure type
49.infix type (median type) median expression (right associative) >>: representative function name median type: the type name is written in the middle of two parameters, and the instance of the generic is on both sides of the type
. Self = aliases An internal class reference for the This instance pointer is very convenient THIS:S1 + = The own type instance constraint must be mixed with S1
Scala Learning Notes