Slide 1

Slide 1 text

kotlin: NewHope In a Java 6 Wasteland

Slide 2

Slide 2 text

100% interoperable with Java™ Statically typed programming language targeting the JVM and JavaScript

Slide 3

Slide 3 text

concise /kənˈsīs/ adjective giving a lot of information clearly and in a few words; brief but comprehensive.

Slide 4

Slide 4 text

expressive /ikˈspresiv/ adjective effectively conveying thought or feeling.

Slide 5

Slide 5 text

safe /sāf/ adjective protected from or not exposed to danger or risk; not likely to be harmed or lost.

Slide 6

Slide 6 text

versatile /ˈvərsədl/ adjective able to adapt or be adapted to many different functions or activities.

Slide 7

Slide 7 text

interoperable /ˌin(t)ərˈäp(ə)rəb(ə)l/ adjective (of computer systems or software) able to exchange and make use of information.

Slide 8

Slide 8 text

Why not wait for Java 8?

Slide 9

Slide 9 text

Java 6 2006

Slide 10

Slide 10 text

Java 6 2006 Android 1.0 2008

Slide 11

Slide 11 text

Java 6 2006 Java 7 2011 Android 1.0 2008

Slide 12

Slide 12 text

Java 6 2006 Java 7 2011 Java 7 Support 2013 Android 1.0 2008

Slide 13

Slide 13 text

Java 6 2006 Java 7 2011 Java 8 2014 Java 7 Support 2013 Android 1.0 2008

Slide 14

Slide 14 text

Java 6 2006 Java 7 2011 Java 8 2014 Java 7 Support 2013 Java 8 Support ???? Android 1.0 2008

Slide 15

Slide 15 text

KitKat Jelly Bean Lollipop Froyo Gingerbread Ice Cream Sandwich

Slide 16

Slide 16 text

KitKat Jelly Bean Lollipop Froyo Gingerbread Ice Cream Sandwich

Slide 17

Slide 17 text

Problems with Java

Slide 18

Slide 18 text

Null references “I call it my billion-dollar mistake… [which] has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.” — Tony Hoare

Slide 19

Slide 19 text

Raw types List numbers = getNumberList(); int sum = 0; for (Object num : numbers) { sum += (Integer) num; // Unchecked cast }

Slide 20

Slide 20 text

Covariant arrays String[] strings = { "hello" }; Object[] objects = strings; objects[0] = 1; // java.lang.ArrayStoreException

Slide 21

Slide 21 text

SAM types interface Func1 { R call(T1 t1); } interface Func2 { R call(T1 t1, T2 t2); } interface Func3 { R call(T1 t1, T2 t2, T3 t3); } // ...

Slide 22

Slide 22 text

Wildcards “I am completely and totally humbled. Laid low. I realize now that I am simply not smart at all. I made the mistake of thinking that I could understand generics. I simply cannot. I just can't. This is really depressing. It is the first time that I've ever not been able to understand something related to computers, in any domain, anywhere, period.” "We simply cannot afford another wildcards” — Joshua Bloch

Slide 23

Slide 23 text

Checked exceptions “… requiring exception specifications could both enhance developer productivity and enhance code quality, but experience with large software projects suggests a different result – decreased productivity and little or no increase in code quality.” — Bruce Eckel

Slide 24

Slide 24 text

Kotlin to the rescue!

Slide 25

Slide 25 text

What Kotlin removes • Checked exceptions • Non-class primitive types • Static members • Non-private fields • Wildcard types

Slide 26

Slide 26 text

What Kotlin adds • Lambdas • Data classes • Function literals & inline functions • Extension functions • Null-safety • Smart casts • String templates • Properties • Primary constructors • Class delegation • Type inference • Singletons • Declaration-site variance • Range expressions

Slide 27

Slide 27 text

Dalvik ART Android Java source javac Kotlin source kotlinc bytecode JVM Backend JVM Desktop

Slide 28

Slide 28 text

Hello, Kotlin!

Slide 29

Slide 29 text

fun main(args: Array): Unit { println("Hello, World!") } > Hello, World!

Slide 30

Slide 30 text

fun main(args: Array): Unit { println("Hello, World!") } Function keyword

Slide 31

Slide 31 text

fun main(args: Array): Unit { println("Hello, World!") } Function name

Slide 32

Slide 32 text

fun main(args: Array): Unit { println("Hello, World!") } Argument name

Slide 33

Slide 33 text

fun main(args: Array): Unit { println("Hello, World!") } Argument type

Slide 34

Slide 34 text

fun main(args: Array): Unit { println("Hello, World!") } Return type

Slide 35

Slide 35 text

fun main(args: Array): Unit { println("Hello, World!") }

Slide 36

Slide 36 text

fun main(args: Array): Unit {. println("Hello, World!") }. Unit inferred

Slide 37

Slide 37 text

fun main(args: Array) {. println("Hello, World!") }.

Slide 38

Slide 38 text

fun main(args: Array) {. println("Hello, World!") }.

Slide 39

Slide 39 text

fun main(args: Array) {. var name = "World" println("Hello, $name!") }.

Slide 40

Slide 40 text

fun main(args: Array) {. var name = "World" println("Hello, $name!") }. Variable declaration

Slide 41

Slide 41 text

fun main(args: Array) {. var name = "World" println("Hello, $name!") }. String interpolation

Slide 42

Slide 42 text

fun main(args: Array) {. var name = "World" if (args.isNotEmpty()) { name = args[0] } println("Hello, $name!") }.

Slide 43

Slide 43 text

fun main(args: Array) {. var name = "World" if (args.isNotEmpty()) { name = args[0] } println("Hello, $name!") }.

Slide 44

Slide 44 text

fun main(args: Array) {. val name = "World" if (args.isNotEmpty()) { name = args[0] } println("Hello, $name!") }.

Slide 45

Slide 45 text

fun main(args: Array) {. val name = "World" if (args.isNotEmpty()) { name = args[0] } println("Hello, $name!") }. Constant declaration

Slide 46

Slide 46 text

fun main(args: Array) {. val name = "World" if (args.isNotEmpty()) { name = args[0] }. println("Hello, $name!") }. Val cannot be reassigned

Slide 47

Slide 47 text

fun main(args: Array) {. val name = "World" if (args.isNotEmpty()) { name = args[0] }. println("Hello, $name!") }.

Slide 48

Slide 48 text

fun main(args: Array) {. val name = if (args.isNotEmpty()) { args[0] } else { "World" }. println("Hello, $name!") }.

Slide 49

Slide 49 text

fun main(args: Array) {. val name = if (args.isNotEmpty()) { args[0] } else { "World" }. println("Hello, $name!") }.

Slide 50

Slide 50 text

fun main(args: Array) {. val name = if (args.isNotEmpty()) { args[0] } else { "World" }. println("Hello, $name!") }. Conditional assignment block

Slide 51

Slide 51 text

fun main(args: Array) { val name = if (args.isNotEmpty()) { args[0] } else { "World" }. println("Hello, $name!") }.

Slide 52

Slide 52 text

fun main(args: Array) { val name = if (args.isNotEmpty()) args[0] else "World" println("Hello, $name!") }.

Slide 53

Slide 53 text

class Person(var name: String) fun main(args: Array) { val name = if (args.isNotEmpty()) args[0] else "World" println("Hello, $name!") }.

Slide 54

Slide 54 text

class Person(var name: String) fun main(args: Array) { val name = if (args.isNotEmpty()) args[0] else "World" println("Hello, $name!") } Class keyword

Slide 55

Slide 55 text

class Person(var name: String) fun main(args: Array) { val name = if (args.isNotEmpty()) args[0] else "World" println("Hello, $name!") } Class name

Slide 56

Slide 56 text

class Person(var name: String) fun main(args: Array) { val name = if (args.isNotEmpty()) args[0] else "World" println("Hello, $name!") } Primary constructor

Slide 57

Slide 57 text

class Person(var name: String) fun main(args: Array) { val name = if (args.isNotEmpty()) args[0] else "World" println("Hello, $name!") } Non-final class member

Slide 58

Slide 58 text

class Person(var name: String) fun main(args: Array) { val name = if (args.isNotEmpty()) args[0] else "World" println("Hello, $name!") }

Slide 59

Slide 59 text

class Person(var name: String) fun main(args: Array) { println("Hello, $name!") }

Slide 60

Slide 60 text

class Person(var name: String) fun main(args: Array) { val person = Person("Michael") println("Hello, $name!") }

Slide 61

Slide 61 text

class Person(var name: String) fun main(args: Array) { val person = Person("Michael") println("Hello, $name!") }. Instance declaration

Slide 62

Slide 62 text

class Person(var name: String) fun main(args: Array) { val person = Person("Michael") println("Hello, $name!") }.

Slide 63

Slide 63 text

class Person(var name: String) fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }. > Hello, Michael!

Slide 64

Slide 64 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") } class Person(var name: String) fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }.

Slide 65

Slide 65 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }.. class Person(var name: String). fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }.

Slide 66

Slide 66 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }.. class Person(var name: String, var lang: Language). fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }.

Slide 67

Slide 67 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }.. class Person(var name: String, var lang: Language = Language.EN). fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }. Default value

Slide 68

Slide 68 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }..

Slide 69

Slide 69 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }. fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }..

Slide 70

Slide 70 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") } class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") } fun main(args: Array) { val person = Person("Michael") println("Hello, ${person.name}!") }

Slide 71

Slide 71 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") } class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") } fun main(args: Array) { val person = Person("Michael") }

Slide 72

Slide 72 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") } class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") } fun main(args: Array) { val person = Person("Michael") person.greet() } > Hello, Michael!

Slide 73

Slide 73 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. fun main(args: Array) { }.

Slide 74

Slide 74 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. fun main(args: Array) { val people = listOf( Person("Michael"), Person("Miguel", Language.SP), Person("Michelle", Language.FR) ). }.

Slide 75

Slide 75 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. fun main(args: Array) { val people = listOf( Person("Michael"), Person("Miguel", Language.SP), Person("Michelle", Language.FR) ). for (person in people) {. person.greet() }. }.

Slide 76

Slide 76 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. fun main(args: Array) { val people = listOf( Person("Michael"), Person("Miguel", Language.SP), Person("Michelle", Language.FR) ). people.forEach {.person -> person.greet() }. }.

Slide 77

Slide 77 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. fun main(args: Array) { val people = listOf( Person("Michael"), Person("Miguel", Language.SP), Person("Michelle", Language.FR) ). people.forEach { it.greet() }. }.

Slide 78

Slide 78 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. fun main(args: Array) { listOf( Person("Michael"), Person("Miguel", Language.SP), Person("Michelle", Language.FR) ).forEach { it.greet() }. }. > Hello, Michael! > Hola, Miguel! > Bonjour, Michelle!

Slide 79

Slide 79 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... open class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. fun main(args: Array) { listOf( Person("Michael"), Person("Miguel", Language.SP), Person("Michelle", Language.FR) ).forEach { it.greet() }. }. Non-final

Slide 80

Slide 80 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... open class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. class Hispanophone(name: String) : Person(name, Language.ES) class Francophone(name: String) : Person(name, Language.FR) fun main(args: Array) { listOf( Person("Michael"), Person("Miguel", Language.SP), Person("Michelle", Language.FR) ).forEach { it.greet() } }.

Slide 81

Slide 81 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... open class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. class Hispanophone(name: String) : Person(name, Language.ES) class Francophone(name: String) : Person(name, Language.FR) fun main(args: Array) { listOf( Person("Michael"), Hispanophone("Miguel"), Francophone("Michelle") ).forEach { it.greet() } }.

Slide 82

Slide 82 text

enum class Language(val greeting: String) { EN("Hello"), ES("Hola"), FR("Bonjour") }... open class Person(var name: String, var lang: Language = Language.EN) { fun greet() = println("${lang.greeting}, $name!") }.. class Hispanophone(name: String) : Person(name, Language.ES) class Francophone(name: String) : Person(name, Language.FR) fun main(args: Array) { listOf( Person("Michael"), Hispanophone("Miguel"), Francophone("Michelle") ).forEach { it.greet() } }.

Slide 83

Slide 83 text

What Kotlin Adds to Java

Slide 84

Slide 84 text

Type inference

Slide 85

Slide 85 text

Type inference String string = "";

Slide 86

Slide 86 text

Type inference var string: String = ""

Slide 87

Slide 87 text

Type inference var string = ""

Slide 88

Slide 88 text

Type inference var string = "" var char = ' '

Slide 89

Slide 89 text

Type inference var string = "" var char = ' ‘ var int = 0

Slide 90

Slide 90 text

Type inference var string = "" var char = ' ‘ var int = 0 var long = 0L

Slide 91

Slide 91 text

Type inference var string = "" var char = ' ‘ var int = 0 var long = 0L var float = 0F

Slide 92

Slide 92 text

Type inference var string = "" var char = ' ‘ var int = 0 var long = 0L var float = 0F var double = 0.0

Slide 93

Slide 93 text

Type inference var string = "" var char = ' ' var int = 0 var long = 0L var float = 0F var double = 0.0 var boolean = true

Slide 94

Slide 94 text

Type inference var string = "" var char = ' ' var int = 0 var long = 0L var float = 0F var double = 0.0 var boolean = true var foo = MyFooType()

Slide 95

Slide 95 text

Null-safety

Slide 96

Slide 96 text

Null-safety String a = null;

Slide 97

Slide 97 text

Null-safety String a = null; System.out.println(a.length());

Slide 98

Slide 98 text

Null-safety String a = null; System.out.println(a.length()); NullPointerException

Slide 99

Slide 99 text

Null-safety val a: String = null

Slide 100

Slide 100 text

Null-safety val a: String = null Non-null type

Slide 101

Slide 101 text

Null-safety val a: String? = null

Slide 102

Slide 102 text

Null-safety val a: String? = null

Slide 103

Slide 103 text

Null-safety val a: String? = null println(a.length())

Slide 104

Slide 104 text

Null-safety val a: String? = null println(a.length()) Unsafe call

Slide 105

Slide 105 text

Null-safety val a: String? = null println(a?.length())

Slide 106

Slide 106 text

Null-safety val a: String? = null println(a?.length()) > null

Slide 107

Slide 107 text

Null-safety int length = a != null ? a.length() : -1

Slide 108

Slide 108 text

Null-safety int length = a != null ? a.length() : -1 Null check

Slide 109

Slide 109 text

Null-safety int length = a != null ? a.length() : -1 Assignment selector

Slide 110

Slide 110 text

Null-safety var length = if (a != null) a.length() else -1

Slide 111

Slide 111 text

Null-safety var length = if (a != null) a.length() else -1 Null check

Slide 112

Slide 112 text

Null-safety var length = if (a != null) a.length() else -1 Assignment selector

Slide 113

Slide 113 text

Null-safety var length = a?.length() ?: -1

Slide 114

Slide 114 text

Null-safety var length = a?.length() ?: -1 Null check

Slide 115

Slide 115 text

Null-safety var length = a?.length() ?: -1 Assignment selector

Slide 116

Slide 116 text

Smart casts

Slide 117

Slide 117 text

Smart casts if (x is String) { print(x.length()) }

Slide 118

Slide 118 text

Smart casts if (x is String) { print(x.length()) } Type check

Slide 119

Slide 119 text

Smart casts if (x is String) { print(x.length()) } Smart cast

Slide 120

Slide 120 text

Smart casts if (x !is String) { return } print(x.size())

Slide 121

Slide 121 text

Smart casts if (x !is String) { return } print(x.size()) Type check

Slide 122

Slide 122 text

Smart casts if (x !is String) { return } print(x.size())

Slide 123

Slide 123 text

Smart casts if (x !is String) { return } print(x.size()) Smart cast

Slide 124

Slide 124 text

Smart casts if (x !is String || x.size() == 0) { return }

Slide 125

Slide 125 text

Smart casts if (x !is String || x.size() == 0) { return } Type check

Slide 126

Slide 126 text

Smart casts if (x !is String || x.size() == 0) { return }

Slide 127

Slide 127 text

Smart casts if (x !is String || x.size() == 0) { return } Smart cast

Slide 128

Slide 128 text

Smart casts if (x is String && x.size() > 0) { print(x.size()) }

Slide 129

Slide 129 text

Smart casts if (x is String && x.size() > 0) { print(x.size()) } Type check

Slide 130

Slide 130 text

Smart casts if (x is String && x.size() > 0) { print(x.size()) }

Slide 131

Slide 131 text

Smart casts if (x is String && x.size() > 0) { print(x.size()) } Smart cast

Slide 132

Slide 132 text

Smart casts if (x is String && x.size() > 0) { print(x.size()) } Smart cast

Slide 133

Slide 133 text

Smart casts when (x) { is Int -> print(x + 1) is String -> print(x.size() + 1) is Array -> print(x.sum()) }

Slide 134

Slide 134 text

Smart casts when (x) { is Int -> print(x + 1) is String -> print(x.size() + 1) is Array -> print(x.sum()) } Type check

Slide 135

Slide 135 text

Smart casts when (x) { is Int -> print(x + 1) is String -> print(x.size() + 1) is Array -> print(x.sum()) } Smart cast

Slide 136

Slide 136 text

Smart casts when (x) { is Int -> print(x + 1) is String -> print(x.size() + 1) is Array -> print(x.sum()) } Type check

Slide 137

Slide 137 text

Smart casts when (x) { is Int -> print(x + 1) is String -> print(x.size() + 1) is Array -> print(x.sum()) } Smart cast

Slide 138

Slide 138 text

Smart casts when (x) { is Int -> print(x + 1) is String -> print(x.size() + 1) is Array -> print(x.sum()) } Type check

Slide 139

Slide 139 text

Smart casts when (x) { is Int -> print(x + 1) is String -> print(x.size() + 1) is Array -> print(x.sum()) } Smart cast

Slide 140

Slide 140 text

String templates

Slide 141

Slide 141 text

String templates val apples = 4 println("I have " + apples + " apples.") > I have 4 apples.

Slide 142

Slide 142 text

String templates val apples = 4 println("I have $apples apples.") > I have 4 apples. > I have 4 apples.

Slide 143

Slide 143 text

String templates val apples = 4 val bananas = 3 println("I have $apples apples and " + (apples + bananas) + " fruits.") > I have 4 apples. > I have 4 apples. > I have 4 apples and 7 fruits.

Slide 144

Slide 144 text

String templates val apples = 4 val bananas = 3 println("I have $apples apples and ${apples+bananas} fruits.") > I have 4 apples. > I have 4 apples and 7 fruits. > I have 4 apples and 7 fruits.

Slide 145

Slide 145 text

Range expressions

Slide 146

Slide 146 text

Range expressions if (1 <= i && i <= 10) { println(i) }

Slide 147

Slide 147 text

Range expressions if (1 <= i && i <= 10) { println(i) }. if (IntRange(1, 10).contains(i)) { println(i) }.

Slide 148

Slide 148 text

Range expressions if (1 <= i && i <= 10) { println(i) }. if (1.rangeTo(10).contains(i)) { println(i) }.

Slide 149

Slide 149 text

Range expressions if (1 <= i && i <= 10) { println(i) }. if (i in 1..10) { println(i) }. Range operator

Slide 150

Slide 150 text

Range expressions for (i in 1..4) { print(i) }. > 1234

Slide 151

Slide 151 text

Range expressions for (i in 1..4 step 2) { print(i) }. > 1234 > 13

Slide 152

Slide 152 text

Range expressions for (i in 4 downTo 1 step 2) { print(i) }. > 1234 > 13 > 42

Slide 153

Slide 153 text

Range expressions for (i in 1.0..2.0) { print("$i ") }. > 13 > 42 > 1.0 2.0

Slide 154

Slide 154 text

Range expressions for (i in 1.0..2.0 step 0.3) { print("$i ") }. > 42 > 1.0 2.0 > 1.0 1.3 1.6 1.9

Slide 155

Slide 155 text

Higher-order functions & lambdas

Slide 156

Slide 156 text

Higher-order functions & lambdas public interface Function { R call(T t); }

Slide 157

Slide 157 text

Higher-order functions & lambdas public interface Function { R call(T t); } public static List filter(Collection items, Function f) { final List filtered = new ArrayList(); for (T item : items) if (f.call(item)) filtered.add(item); return filtered; }

Slide 158

Slide 158 text

Higher-order functions & lambdas public interface Function { R call(T t); } public static List filter(Collection items, Function f) { final List filtered = new ArrayList(); for (T item : items) if (f.call(item)) filtered.add(item); return filtered; } filter(numbers, new Function() { @Override public Boolean call(Integer value) { return value % 2 == 0; } });

Slide 159

Slide 159 text

Higher-order functions & lambdas public interface Function { R call(T t); } public static List filter(Collection items, Function f) { final List filtered = new ArrayList(); for (T item : items) if (f.call(item)) filtered.add(item); return filtered; } filter(numbers, new Function() { @Override public Boolean call(Integer value) { return value % 2 == 0; } });

Slide 160

Slide 160 text

Higher-order functions & lambdas public interface Function { R call(T t); } public static List filter(Collection items, Function f) { final List filtered = new ArrayList(); for (T item : items) if (f.call(item)) filtered.add(item); return filtered; } filter(numbers, new Function() { @Override public Boolean call(Integer value) { return value % 2 == 0; } }); Functional interface

Slide 161

Slide 161 text

Higher-order functions & lambdas public interface Function { R call(T t); } public static List filter(Collection items, Function f) { final List filtered = new ArrayList(); for (T item : items) if (f.call(item)) filtered.add(item); return filtered; } filter(numbers, new Function() { @Override public Boolean call(Integer value) { return value % 2 == 0; } }); Interface argument

Slide 162

Slide 162 text

Higher-order functions & lambdas public interface Function { R call(T t); } public static List filter(Collection items, Function f) { final List filtered = new ArrayList(); for (T item : items) if (f.call(item)) filtered.add(item); return filtered; } filter(numbers, new Function() { @Override public Boolean call(Integer value) { return value % 2 == 0; } }); Interface function call

Slide 163

Slide 163 text

Higher-order functions & lambdas public interface Function { R call(T t); } public static List filter(Collection items, Function f) { final List filtered = new ArrayList(); for (T item : items) if (f.call(item)) filtered.add(item); return filtered; } filter(numbers, new Function() { @Override public Boolean call(Integer value) { return value % 2 == 0; } }); Anonymous implementation

Slide 164

Slide 164 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered }

Slide 165

Slide 165 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered } filter(numbers, { value -> value % 2 == 0 })

Slide 166

Slide 166 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered } filter(numbers, { value -> value % 2 == 0 })

Slide 167

Slide 167 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered } filter(numbers, { value -> value % 2 == 0 }) Function type

Slide 168

Slide 168 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered } filter(numbers, { value -> value % 2 == 0 }) Function call

Slide 169

Slide 169 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered } filter(numbers, { value -> value % 2 == 0 }) Anonymous function

Slide 170

Slide 170 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered }. filter(numbers, { value -> value % 2 == 0 } . )

Slide 171

Slide 171 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered }. filter(numbers) { value -> value % 2 == 0 } .

Slide 172

Slide 172 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered }. filter(numbers) { it % 2 == 0 } .

Slide 173

Slide 173 text

Higher-order functions & lambdas fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered }. filter(numbers) { it % 2 == 0 } .

Slide 174

Slide 174 text

Inline functions

Slide 175

Slide 175 text

Inline functions fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered }. filter(numbers) { it % 2 == 0 }

Slide 176

Slide 176 text

Inline functions inline fun filter(items: Collection, f: (T) -> Boolean): List { val filtered = arrayListOf() for (item in items) if (f(item)) filtered.add(item) return filtered }. filter(numbers) { it % 2 == 0 }

Slide 177

Slide 177 text

Inline functions val filtered = arrayListOf() for (item in items) if (it % 2 == 0) filtered.add(item)

Slide 178

Slide 178 text

Inline functions fun call(f: () -> Unit) { f() } call { return }

Slide 179

Slide 179 text

Inline functions fun call(f: () -> Unit) { f() } call { return } Return not allowed

Slide 180

Slide 180 text

Inline functions fun call(f: () -> Unit) { f() }. call { return }.

Slide 181

Slide 181 text

Inline functions inline fun call(f: () -> Unit) { f() }. call { return }.

Slide 182

Slide 182 text

Inline functions inline fun call(f: () -> Unit) { f() }. call { return }. Return allowed

Slide 183

Slide 183 text

Inline functions inline fun View.findViewParent(): T? { var parent = getParent() while (parent != null && parent !is T) { parent = parent.getParent() } return parent as T }

Slide 184

Slide 184 text

Inline functions inline fun View.findViewParent(): T? { var parent = getParent() while (parent != null && parent !is T) { parent = parent.getParent() } return parent as T } Type erasure

Slide 185

Slide 185 text

Inline functions inline fun View.findViewParent(): T? { var parent = getParent() while (parent != null && parent !is T) { parent = parent.getParent() } return parent as T } Unchecked cast

Slide 186

Slide 186 text

Inline functions inline fun View.findViewParent(): T? { var parent = getParent() while (parent != null && parent !is T) { parent = parent.getParent() }. return parent as T }.

Slide 187

Slide 187 text

Inline functions inline fun View.findViewParent(): T? { var parent = getParent() while (parent != null && parent !is T) { parent = parent.getParent() }. return parent as T }. Reified type

Slide 188

Slide 188 text

Inline functions inline fun View.findViewParent(): T? { var parent = getParent() while (parent != null && parent !is T) { parent = parent.getParent() } return parent as T } Type check allowed

Slide 189

Slide 189 text

Inline functions inline fun View.findViewParent(): T? { var parent = getParent() while (parent != null && parent !is T) { parent = parent.getParent() } return parent as T } Type cast allowed

Slide 190

Slide 190 text

Extension functions

Slide 191

Slide 191 text

Extension functions public fun isLollipopOrGreater(code: Int): Boolean { return code >= Build.VERSION_CODES.LOLLIPOP }.

Slide 192

Slide 192 text

Extension functions public fun isLollipopOrGreater(code: Int): Boolean { return code >= Build.VERSION_CODES.LOLLIPOP }.

Slide 193

Slide 193 text

Extension functions public fun Int.isLollipopOrGreater(code: Int): Boolean { return code >= Build.VERSION_CODES.LOLLIPOP }.

Slide 194

Slide 194 text

Extension functions public fun Int.isLollipopOrGreater(): Boolean { return code >= Build.VERSION_CODES.LOLLIPOP }.

Slide 195

Slide 195 text

Extension functions public fun Int.isLollipopOrGreater(): Boolean {. return this >= Build.VERSION_CODES.LOLLIPOP }..

Slide 196

Slide 196 text

Extension functions public fun Int.isLollipopOrGreater(): Boolean {. return this >= Build.VERSION_CODES.LOLLIPOP }.. if (Build.VERSION.SDK_INT.isLollipopOrGreater) { // ... }.

Slide 197

Slide 197 text

Extension functions public fun Int.isLollipopOrGreater(): Boolean {. return this >= Build.VERSION_CODES.LOLLIPOP }. if (16.isLollipopOrGreater) { // ... }.

Slide 198

Slide 198 text

Extension functions final Function customerMapper = // ... final Function orderFilter = // ... final Function orderSorter = // ... final List vipOrders = sortBy(filter(map(customers, customerMapper), orderFilter), orderSorter);

Slide 199

Slide 199 text

Extension functions final Function customerMapper = // ... final Function orderFilter = // ... final Function orderSorter = // ... final List vipOrders = sortBy(filter(map(customers, customerMapper), orderFilter), orderSorter);

Slide 200

Slide 200 text

Extension functions final Function customerMapper = // ... final Function orderFilter = // ... final Function orderSorter = // ... final List vipOrders = sortBy(filter(map(customers, customerMapper), orderFilter), orderSorter);

Slide 201

Slide 201 text

Extension functions final Function customerMapper = // ... final Function orderFilter = // ... final Function orderSorter = // ... final List vipOrders = sortBy(filter(map(customers, customerMapper), orderFilter), orderSorter);

Slide 202

Slide 202 text

Extension functions final Function customerMapper = // ... final Function orderFilter = // ... final Function orderSorter = // ... final List vipOrders = sortBy(filter(map(customers, customerMapper), orderFilter), orderSorter);

Slide 203

Slide 203 text

Extension functions val vipOrders = customers .map { it.lastOrder } .filter { it.total >= 500F } .sortBy { it.total }

Slide 204

Slide 204 text

Extension functions val vipOrders = customers .map { it.lastOrder } .filter { it.total >= 500F } .sortBy { it.total }

Slide 205

Slide 205 text

Extension functions val vipOrders = customers .map { it.lastOrder } .filter { it.total >= 500F } .sortBy { it.total }

Slide 206

Slide 206 text

Extension functions val vipOrders = customers .map { it.lastOrder } .filter { it.total >= 500F } .sortBy { it.total }

Slide 207

Slide 207 text

Extension functions val vipOrders = customers .map { it.lastOrder } .filter { it.total >= 500F } .sortBy { it.total }

Slide 208

Slide 208 text

Extension functions val vipOrders = customers .map { it.lastOrder } .filter { it.total >= 500F } .sortBy { it.total }

Slide 209

Slide 209 text

Properties

Slide 210

Slide 210 text

Properties class Customer { private String firstName; private String lastName; private String email; public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getEmail() { return email; } public void setFirstName(String firstName) { this.firstName = firstName } public void setLastName(String lastName) { this.lastName = lastName } public void setEmail(String email) { this.email = email } }

Slide 211

Slide 211 text

Properties class Customer { private String firstName; private String lastName; private String email; public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getEmail() { return email; } public void setFirstName(String firstName) { this.firstName = firstName } public void setLastName(String lastName) { this.lastName = lastName } public void setEmail(String email) { this.email = email } }

Slide 212

Slide 212 text

Properties class Customer { private String firstName; private String lastName; private String email; public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getEmail() { return email; } public void setFirstName(String firstName) { this.firstName = firstName } public void setLastName(String lastName) { this.lastName = lastName } public void setEmail(String email) { this.email = email } }

Slide 213

Slide 213 text

Properties class Customer { private String firstName; private String lastName; private String email; public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getEmail() { return email; } public void setFirstName(String firstName) { this.firstName = firstName } public void setLastName(String lastName) { this.lastName = lastName } public void setEmail(String email) { this.email = email } }

Slide 214

Slide 214 text

Properties class Customer { var firstName: String = // ... var lastName: String = // ... var email: String = // ... }

Slide 215

Slide 215 text

Properties class Customer { var firstName: String = // ... var lastName: String = // ... var email: String = // ... } val customer = Customer() customer.firstName = "Michael" customer.lastName = "Pardo" customer.email = "michael@michaelpardo.com"

Slide 216

Slide 216 text

Primary constructors

Slide 217

Slide 217 text

Primary constructors class Customer {. var firstName: String = // ... var lastName: String = // ... var email: String = // ... }.

Slide 218

Slide 218 text

Primary constructors class Customer(firstName: String, lastName: String, email: String) {. var firstName: String = // ... var lastName: String = // ... var email: String = // ... }.

Slide 219

Slide 219 text

Primary constructors class Customer(firstName: String, lastName: String, email: String) {. var firstName: String = firstName var lastName: String = lastName var email: String = email }.

Slide 220

Slide 220 text

Primary constructors class Customer(firstName: String, lastName: String, email: String) {. var firstName: String var lastName: String var email: String init { this.firstName = firstName this.lastName = lastName this.email = email } }.

Slide 221

Slide 221 text

Primary constructors class Customer(firstName: String, lastName: String, email: String)

Slide 222

Slide 222 text

Primary constructors class Customer(var firstName: String, var lastName: String, var email: String)

Slide 223

Slide 223 text

Primary constructors class Customer( var firstName: String, var lastName: String, var email: String)

Slide 224

Slide 224 text

Primary constructors class Customer( val firstName: String, val lastName: String, val email: String)

Slide 225

Slide 225 text

Singletons

Slide 226

Slide 226 text

Singletons public class Singleton { private static volatile Singleton instance; private Singleton() { } public static Singleton getInstance() { if (instance == null ) { synchronized (Singleton.class) { if (instance == null) { instance = new Singleton(); } } } return instance; } }

Slide 227

Slide 227 text

Singletons public class Singleton { private static volatile Singleton instance = null; private Singleton() { } public static synchronized Singleton getInstance() { if (instance == null) { instance = new Singleton(); } return instance; } }

Slide 228

Slide 228 text

Singletons public class Singleton { private static final Singleton INSTANCE = new Singleton(); private Singleton() {} public static Singleton getInstance() { return INSTANCE; } }

Slide 229

Slide 229 text

Singletons public class Singleton { private static final Singleton instance; static { try { instance = new Singleton(); } catch (Exception e) { throw new RuntimeException("Darn, an error occurred!", e); } } public static Singleton getInstance() { return instance; } private Singleton() { } }

Slide 230

Slide 230 text

Singletons public class Singleton { private Singleton() { } private static class SingletonHolder { private static final Singleton INSTANCE = new Singleton(); } public static Singleton getInstance() { return SingletonHolder.INSTANCE; } }

Slide 231

Slide 231 text

Singletons public enum Singleton { INSTANCE; public void execute (String arg) { } }

Slide 232

Slide 232 text

Singletons object Singleton

Slide 233

Slide 233 text

Singletons object Logger { val tag = "TAG" fun d(message: String) { Log.d(tag, message) } }

Slide 234

Slide 234 text

Companion objects

Slide 235

Slide 235 text

Companion objects class LaunchActivity extends AppCompatActivity { public static final String TAG = LaunchActivity.class.getName(); public static void start(Context context) { context.startActivity(new Intent(context, LaunchActivity.class)); } }

Slide 236

Slide 236 text

Companion objects class LaunchActivity extends AppCompatActivity { public static final String TAG = LaunchActivity.class.getName(); public static void start(Context context) { context.startActivity(new Intent(context, LaunchActivity.class)); } }

Slide 237

Slide 237 text

Companion objects class LaunchActivity extends AppCompatActivity { public static final String TAG = LaunchActivity.class.getName(); public static void start(Context context) { context.startActivity(new Intent(context, LaunchActivity.class)); } }

Slide 238

Slide 238 text

Companion objects class LaunchActivity extends AppCompatActivity { public static final String TAG = LaunchActivity.class.getName(); public static void start(Context context) { context.startActivity(new Intent(context, LaunchActivity.class)); } } Timber.v("Starting activity %s", LaunchActivity.TAG);

Slide 239

Slide 239 text

Companion objects class LaunchActivity extends AppCompatActivity { public static final String TAG = LaunchActivity.class.getName(); public static void start(Context context) { context.startActivity(new Intent(context, LaunchActivity.class)); } } Timber.v("Starting activity %s", LaunchActivity.TAG); LaunchActivity.start(context);

Slide 240

Slide 240 text

Companion objects class LaunchActivity { companion object { val TAG: String = LaunchActivity::class.simpleName fun start(context: Context) { context.startActivity(Intent(context, LaunchActivity::class)) } } }

Slide 241

Slide 241 text

Companion objects class LaunchActivity { companion object { val TAG: String = LaunchActivity::class.simpleName fun start(context: Context) { context.startActivity(Intent(context, LaunchActivity::class)) } } }

Slide 242

Slide 242 text

Companion objects class LaunchActivity { companion object { val TAG: String = LaunchActivity::class.simpleName fun start(context: Context) { context.startActivity(Intent(context, LaunchActivity::class)) } } }

Slide 243

Slide 243 text

Companion objects class LaunchActivity { companion object { val TAG: String = LaunchActivity::class.simpleName fun start(context: Context) { context.startActivity(Intent(context, LaunchActivity::class)) } } }

Slide 244

Slide 244 text

Companion objects class LaunchActivity { companion object { val TAG: String = LaunchActivity::class.simpleName fun start(context: Context) { context.startActivity(Intent(context, LaunchActivity::class)) } } } Timber.v("Starting activity ${LaunchActivity.TAG}")

Slide 245

Slide 245 text

Companion objects class LaunchActivity { companion object { val TAG: String = LaunchActivity::class.simpleName fun start(context: Context) { context.startActivity(Intent(context, LaunchActivity::class)) } } } Timber.v("Starting activity ${LaunchActivity.TAG}") LaunchActivity.start(context)

Slide 246

Slide 246 text

Class delegation

Slide 247

Slide 247 text

Class delegation public class MyList implements List { private List delegate; public MyList(delegate: List) { this.delegate = delegate; } // ... public E get(int location) { return delegate.get(location) } // ... }

Slide 248

Slide 248 text

Class delegation public class MyList implements List { private List delegate; public MyList(delegate: List) { this.delegate = delegate; } // ... public E get(int location) { return delegate.get(location) } // ... }

Slide 249

Slide 249 text

Class delegation public class MyList implements List { private List delegate; public MyList(delegate: List) { this.delegate = delegate; } // ... public E get(int location) { return delegate.get(location) } // ... }

Slide 250

Slide 250 text

Class delegation public class MyList implements List { private List delegate; public MyList(delegate: List) { this.delegate = delegate; } // ... public E get(int location) { return delegate.get(location) } // ... }

Slide 251

Slide 251 text

Class delegation public class MyList implements List { private List delegate; public MyList(delegate: List) { this.delegate = delegate; } // ... public E get(int location) { return delegate.get(location) } // ... }

Slide 252

Slide 252 text

Class delegation class MyList(list: List) : List by list

Slide 253

Slide 253 text

Class delegation class MyList(list: List) : List by list

Slide 254

Slide 254 text

Class delegation class MyList(list: List) : List by list

Slide 255

Slide 255 text

Class delegation class MyList(list: List) : List by list

Slide 256

Slide 256 text

Declaration-site variance

Slide 257

Slide 257 text

Declaration-site variance String[] strings = { "hello", "world" }; Object[] objects = strings;

Slide 258

Slide 258 text

Declaration-site variance List strings = Arrays.asList("hello", "world"); List objects = strings;

Slide 259

Slide 259 text

Declaration-site variance List strings = Arrays.asList("hello", "world"); List objects = strings; Error: incompatible types

Slide 260

Slide 260 text

Declaration-site variance List strings = Arrays.asList("hello", "world"); List objects = strings;

Slide 261

Slide 261 text

Declaration-site variance List strings = Arrays.asList("hello", "world"); List extends Object> objects = strings;

Slide 262

Slide 262 text

Declaration-site variance public interface List extends Collection { public boolean addAll(Collection extends E> collection); public E get(int location); }

Slide 263

Slide 263 text

Declaration-site variance public interface List : Collection { public fun get(index: Int): E } public interface MutableList : List, MutableCollection { override fun addAll(c: Collection): Boolean }

Slide 264

Slide 264 text

Declaration-site variance public interface List : Collection { public fun get(index: Int): E } public interface MutableList : List, MutableCollection { override fun addAll(c: Collection): Boolean }

Slide 265

Slide 265 text

Declaration-site variance public interface List : Collection { public fun get(index: Int): E } public interface MutableList : List, MutableCollection { override fun addAll(c: Collection): Boolean }

Slide 266

Slide 266 text

Declaration-site variance val strings: List = listOf("hello", "world") val objects: List = strings

Slide 267

Slide 267 text

Declaration-site variance val strings: List = arrayListOf("hello", "world") val objects: List = strings

Slide 268

Slide 268 text

Declaration-site variance val strings: MutableList = arrayListOf("hello", "world") val objects: List = strings

Slide 269

Slide 269 text

Declaration-site variance val strings: MutableList = arrayListOf("hello", "world") val objects: MutableList = strings

Slide 270

Slide 270 text

Declaration-site variance val strings: MutableList = arrayListOf("hello", "world") val objects: MutableList = strings Type mismatch

Slide 271

Slide 271 text

Operator overloading

Slide 272

Slide 272 text

Operator overloading enum class Coin(val cents: Int) { PENNY(1), NICKEL(5), DIME(10), QUARTER(25), }

Slide 273

Slide 273 text

Operator overloading enum class Coin(val cents: Int) { PENNY(1), NICKEL(5), DIME(10), QUARTER(25), }. class Purse(var amount: Float)

Slide 274

Slide 274 text

Operator overloading enum class Coin(val cents: Int) { PENNY(1), NICKEL(5), DIME(10), QUARTER(25), }. class Purse(var amount: Float) { fun plusAssign(coin: Coin): Unit { amount += (coin.cents / 100f) } } Reserved function name

Slide 275

Slide 275 text

Operator overloading enum class Coin(val cents: Int) { PENNY(1), NICKEL(5), DIME(10), QUARTER(25), } class Purse(var amount: Float) { fun plusAssign(coin: Coin): Unit { amount += (coin.cents / 100f) } } var purse = Purse(1.50f)

Slide 276

Slide 276 text

Operator overloading enum class Coin(val cents: Int) { PENNY(1), NICKEL(5), DIME(10), QUARTER(25), } class Purse(var amount: Float) { fun plusAssign(coin: Coin): Unit { amount += (coin.cents / 100f) } } var purse = Purse(1.50f) purse += Coin.QUARTER // 1.75

Slide 277

Slide 277 text

Operator overloading enum class Coin(val cents: Int) { PENNY(1), NICKEL(5), DIME(10), QUARTER(25), } class Purse(var amount: Float) { fun plusAssign(coin: Coin): Unit { amount += (coin.cents / 100f) } } var purse = Purse(1.50f) purse += Coin.QUARTER // 1.75 purse += Coin.DIME // 1.85

Slide 278

Slide 278 text

Operator overloading enum class Coin(val cents: Int) { PENNY(1), NICKEL(5), DIME(10), QUARTER(25), } class Purse(var amount: Float) { fun plusAssign(coin: Coin): Unit { amount += (coin.cents / 100f) } } var purse = Purse(1.50f) purse += Coin.QUARTER // 1.75 purse += Coin.DIME // 1.85 purse += Coin.PENNY // 1.86

Slide 279

Slide 279 text

Operator overloading a + b a - b a * b a / b a % b a == b a != b a +- b a -= b a *= b a /= b a %= b a > b a < b a >= b a <= b a++ a-- a[] a() a..b a in b a !in b

Slide 280

Slide 280 text

Adding Kotlin to your project

Slide 281

Slide 281 text

app └── src └── main ├── java └── kotlin

Slide 282

Slide 282 text

app └── src └── main ├── java └── kotlin

Slide 283

Slide 283 text

buildscript { repositories { mavenCentral() } dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' } } apply plugin "kotlin-android" sourceSets { main.kotlin.srcDirs += 'src/main/myKotlin' } repositories { mavenCentral() } dependencies { compile 'org.jetbrains.kotlin:kotlin-stdlib:' }

Slide 284

Slide 284 text

buildscript { repositories { mavenCentral() } dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' } } apply plugin "kotlin-android" sourceSets { main.kotlin.srcDirs += 'src/main/myKotlin' } repositories { mavenCentral() } dependencies { compile 'org.jetbrains.kotlin:kotlin-stdlib:' }

Slide 285

Slide 285 text

buildscript { repositories { mavenCentral() } dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' } } apply plugin "kotlin-android" sourceSets { main.kotlin.srcDirs += 'src/main/myKotlin' } repositories { mavenCentral() } dependencies { compile 'org.jetbrains.kotlin:kotlin-stdlib:' }

Slide 286

Slide 286 text

buildscript { repositories { mavenCentral() } dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' } } apply plugin "kotlin-android" sourceSets { main.kotlin.srcDirs += 'src/main/myKotlin' } repositories { mavenCentral() } dependencies { compile 'org.jetbrains.kotlin:kotlin-stdlib:' }

Slide 287

Slide 287 text

No content

Slide 288

Slide 288 text

Resources • http://kotlinlang.org/docs/reference/ • http://kotlinlang.org/docs/tutorials/koans.html • http://kotlinlang.org/docs/reference/comparison-to-java.html

Slide 289

Slide 289 text

Questions? @pardom