Variance in generics
Declaration vs Use-Site
±notation
Co/Con/In-variance
Reflection
classOf[]
Manifest and ClassManifest
Passed with a Context Bound
instanceof
Implicits
Conversions
View Bounds
Pimp-My-Library
Parameters
Final Parameter List may be implicit
e.g Ordering[T] passed to sort
method
Context Bounds as syntaactic sugar:
foo[T: Ordered](a: Any) === foo[T](a:
Any)(implicit ev1$: Ordered[T])
Poor Mans Typeclasses:
http://lampwww.epfl.ch/~odersky/talks/wg2.8-boston06.pdf
Implicit Scope
Local members (vals/vars/object/defs)
and Imported
members, (Shadowed by name!)
Companion object of parts of
expected type
Collections
Mutable vs Immutable
Seq vs List vs Iterable vs Traversable
Maps
A map is a function
Lists
cons
head
tail
Nil
Tuples / Pair
a -> b syntactic sugar
(a,b) syntactic sugar
Basic Generics
[] notation
Exception Handling
packages and imports
_ instead of *
import anywhere
multiple package statements and resolution
import from an instance
First-Class Functions
apply()
passing as an argument
higher-typed
functions vs methods
anonymous functions
underscore (_) as a placeholder
Partial Application
Currying
Singleton as a Function
Using apply on a companion
object - factory pattern
Anonymous => syntactic sugar
vals/vars
'name:Type' instead of 'Type name'
equivalent to Java's final
immutability encouraged by default
To Be Organised
Scope
private[this]
private[package]
private[<whatever>]
Objects and Friends
classes
Body is the primary constructor
Secondary constructors
val & var on params
Singletons
Companions
Singleton is provided via
companion object
Traits
mixins
Case Class Basics
hashcode/equals/canEqual
args as vals
Constructing without 'new', Postpone explanation of
how this is achieved
toString
Postpone usage in pattern
matching until pattern
matching is introduced
Package Objects
notes on this map
Try not to mention any feature unless it's
defined in terms of stuff above it on the
list
Unless under 'To Be Organised',
where anything goes!
Methods (defs)
Don't *require* parenthesis
multiple argument lists
Unit instead of void
'()' syntactic sugar
': Unit' vs. not using '='
If single statement, don't require { braces }
Named arguments
Default arguments
Varargs and the _* notation
override is a required keyword, not an annotation
Exception checking is not forced
the @throws annotation
'Nothing' subclasses everything
Nested/inner methods
Uniform Access Principle
How getters/setters work
Overriding defs with vals/vars
@BeanPropery and @BeanInfo
Type Basics
Inference
With recursive functions
Type Ascription
e.g. val b = 2 : Byte
Any/AnyRef/AnyVal vs Object
Oddities and FAQs
null vs Option[]
null/None/Nothing/Nil
Tooling support
Build systems
IDEs
Code Coverage
Specialist Topics
Testing
Specs
ScalaTest
SUnit
Java Interop
Collections
Array and GenericArray
Generics (erasure)
Concurrency
threads
Actors, react/reply, reactors, lift/akka/scalaz
fork/join
3rd Party Libs
scaladb
scalaz
scalax
akka
liftweb
Patterns
binding
simple usage - assigning a tuple to 2 vals
match blocks
Matching on Structure
Matching on Type
Matching on absolutes
and case classes
sealed cases and exhaustive matches
catch-all with an undescore
Use in for comprehension
Extractors
unapply
unapplySeq
Advanced Functions
higher-typed functions
call by name
PartialFunction
From a match block
isDefinedAt
closures
For Comprehensions
Simple for (i <- 0 to 10) {println i}
Multiple Generators
Using yield to return a
collection of the same type as
the input
Desugaring to map/filter/flatmap/foreach
New node
New node