Slide 4
Slide 4 text
FR
Type Declarations
• Don’t declare variable type when it’s redundant or obvious
• Don’t declare generic types when it’s redundant
• Kotlin has a stronger type system than Java and can infer more
4
// Good, type is obvious
val name = "Dan"
// Bad, redundant type
val friend: Person = Person("Dan")
// Good, type is obvious List
val names = listOf("Dan", "Bob")
// Bad, redundant generic type
val friends = listOf(Person("Dan"), Person("Bob"))