A Tour of Scala: Local Type Inference

Scala has a built-in type inference mechanism which allows the programmer to omit certain type annotations. It is, for instance, often not necessary in Scala to specify the type of a variable, since the compiler can deduce the type from the initialization expression of the variable. Also return types of methods can often be omitted since they corresponds to the type of the body, which gets inferred by the compiler.

It is also not compulsory to specify type parameters when polymorphic methods[1] are called or generic classes[2] are instantiated. The Scala compiler will infer such missing type parameters from the context and from the types of the actual method/constructor parameters.