135
Jake Wharton A Builder's Intro to Kotlin

A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

  • Upload
    others

  • View
    54

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Jake Wharton

A Builder's Intro to Kotlin

Page 2: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Kotlin?

Page 3: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 4: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 5: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 6: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 7: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 8: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 9: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 10: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 11: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 12: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 13: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 14: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 15: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Why Kotlin?

Page 16: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin Author

Page 17: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin Author Buildscript Author

Page 18: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin Author Buildscript Author App Developer

Page 19: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val firstName: String = "Jake" val lastName: String? = null

Page 20: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val firstName: String = "Jake" val lastName: String? = null

Page 21: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val firstName: String = "Jake" val lastName: String? = null

Page 22: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val firstName: String = "Jake" val lastName: String? = null

Page 23: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val firstName: String = "Jake" val lastName: String? = null

Page 24: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val firstName = "Jake" val lastName: String? = null

Page 25: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { public String getName() { // ... } public void setName(String name) { // ... } }

// ^^^ Java

Page 26: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { public String getName() { // ... }X public void setName(String name) { // ... }Y }Z

// ^^^ Java vvv Kotlin

val user = User()println("Name is " + user.name)

Page 27: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { public String getName() { // ... }X public void setName(String name) { // ... }Y }Z

// ^^^ Java vvv Kotlin

val user = User()println("Name is " + user.name)X

Page 28: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { public String getName() { // ... }X public void setName(String name) { // ... }Y }Z

// ^^^ Java vvv Kotlin

val user = User()println("Name is ${user.name}")X

Page 29: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { public String getName() { // ... }X public void setName(String name) { // ... }Y }Z

// ^^^ Java vvv Kotlin

val user = User()println("Name is $user")X

Page 30: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { public String getName() { // ... }X public void setName(String name) { // ... }Y }Z

// ^^^ Java vvv Kotlin

val user = User()println("Name is $user")X

Page 31: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { var name = "Jake" }

// ^^^ Kotlin

Page 32: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { var name = "Jake" }

// ^^^ Kotlin vvv Java

User user = new User(); System.out.println("Name is " + user.getName());

Page 33: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { var name = "Jake" }

// ^^^ Kotlin vvv Java

User user = new User(); System.out.println("Name is " + user.getName());

Page 34: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { var name = "Jake" }

// ^^^ Kotlin vvv Java

User user = new User(); System.out.println("Name is " + user.getName()); user.setName("Jane");

Page 35: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User { var name = "Jake" }

// ^^^ Kotlin vvv Java

User user = new User(); System.out.println("Name is " + user.getName()); user.setName("Jane");

Page 36: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val user = User()

Page 37: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val user = User()user = User()

Page 38: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val user = User()user = User() var currentUser = User() currentUser = User()

Page 39: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun Date.isTuesday(): Boolean { return day == 2 }

Page 40: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun Date.isTuesday(): Boolean { return day == 2 }

val epoch = Date(1970, 0, 0) if (epoch.isTuesday()) { println("The epoch was a Tuesday.") } else { println("The epoch was not a Tuesday.") }

Page 41: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun Date.isTuesday(): Boolean { return day == 2 }

val epoch = Date(1970, 0, 0) if (epoch.isTuesday()) { println("The epoch was a Tuesday.") } else { println("The epoch was not a Tuesday.") }

Page 42: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun Date.isTuesday(): Boolean { return day == 2 }

val epoch = Date(1970, 0, 0) if (epoch.isTuesday()) { println("The epoch was a Tuesday.") } else { println("The epoch was not a Tuesday.") }

// ^^^ Kotlin vvv Java

DateKt.isTuesday(date)

Page 43: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val executor = Executors.newSingleThreadExecutor();executor.execute {Bprintln("Background thread!") }X

Page 44: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val executor = Executors.newSingleThreadExecutor(); val foo = Foo()executor.execute(foo::printIt)

class Foo { fun printIt() {B println("Background thread!") }X }

Page 45: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val executor = Executors.newSingleThreadExecutor(); val foo = Foo()executor.execute(foo::printIt)

class Foo { fun printIt() {B println("Background thread!") }X }

Page 46: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }

Page 47: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }

Page 48: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val odds = items.filter({ item -> item % 2 != 0 })B

Page 49: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val odds = items.filter({ item -> item % 2 != 0 })B

Page 50: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val odds = items.filter({ it % 2 != 0 })B

Page 51: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val odds = items.filter()B{ it % 2 != 0 }

Page 52: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val odds = items.filter { it % 2 != 0 }

Page 53: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val oddList = items.filter { it % 2 != 0 } val oddSet = items.filterTo(mutableListOf()) { it % 2 != 0 }

Page 54: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val odds = items.filter { it % 2 != 0 }

Page 55: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { // ... }A

val items = listOf(1, 2, 3) val odds = items.filter { it % 2 != 0 }

Page 56: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { val destination = mutableListOf<T>() for (item in this) { if (predicate(item)) destination.add(item) }B return destination }A

val items = listOf(1, 2, 3) val odds = items.filter { it % 2 != 0 }

val destination = mutableListOf< >() for (item in ) { if ( item ) destination.add(item) }G destination

Page 57: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <T> List<T>.filter(predicate: (T) -> Boolean): List<T> { val destination = mutableListOf<T>() for (item in this) { if (predicate(item)) destination.add(item) }B return destination }A

val items = listOf(1, 2, 3) val destination = mutableListOf<Int>() for (item in items) { if (item % 2 != 0) destination.add(item) }G val odds = destination

filter it

Page 58: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filterIsInstance(c: Class<T>): List<T> { val destination = mutableListOf<T>() for (item in this) { if (c.isInstance(item)) destination.add(item) } return destination }A

Page 59: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filterIsInstance(c: Class<T>): List<T> { val destination = mutableListOf<T>() for (item in this) { if (c.isInstance(item)) destination.add(item) }G return destination }A

Page 60: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filterIsInstance(): List<T> { val destination = mutableListOf<T>() for (item in this) { if (item in T) destination.add(item) }G return destination }A

c: Class<T>

c.isInstance( )

Page 61: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun <T> List<T>.filterIsInstance(): List<T> { val destination = mutableListOf<T>() for (item in this) { if (item in T) destination.add(item) }G return destination }A

Page 62: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <T> List<T>.filterIsInstance(): List<T> { val destination = mutableListOf<T>() for (item in this) { if (item in T) destination.add(item) }G return destination }A

Page 63: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <reified T> List<T>.filterIsInstance(): List<T> { val destination = mutableListOf<T>() for (item in this) { if (item in T) destination.add(item) }G return destination }A

Page 64: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <reified T> List<T>.filterIsInstance(): List<T> { val destination = mutableListOf<T>() for (item in this) { if (item in T) destination.add(item) }G return destination }A

Page 65: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <reified T> List<T>.filterIsInstance(): List<T> { val destination = mutableListOf<T>() for (item in this) { if (item in T) destination.add(item) } return destination }A

val list = listOf(1, 2f, 3, 4f) val ints = list.filterIsInstance<Int>()

Page 66: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

inline fun <reified T> List<T>.filterIsInstance(): List<T> { val destination = mutableListOf<T>() for (item in this) { if (item in T) destination.add(item) } return destination }A

val list = listOf(1, 2f, 3, 4f) val ints = list.filterIsInstance<Int>()

ALOAD 7 # item INSTANCEOF java/lang/Integer IFEQ L8 ALOAD 5 # destination ALOAD 7 # item INVOKEINTERFACE java/util/Collection.add (Ljava/lang/Object;)Z

Page 67: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User {D val name = "Jake" }A

Page 68: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User(name: String) {D val name = name }A

"Jake"

Page 69: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User(val name: String) { }A

Page 70: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User(val name: String)

Page 71: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User(val name: String)

val jake = User("Jake") println("Hello, $jake!")

Page 72: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class User(val name: String)

val jake = User("Jake") println("Hello, $jake!")

Hello, User@3a71f4dd!

Page 73: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

data class User(val name: String)

val jake = User("Jake") println("Hello, $jake!")

Hello, User@3a71f4dd!

Page 74: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

@3a71f4dd

data class User(val name: String)

val jake = User("Jake") println("Hello, $jake!")

Hello, User(name=Jake)!

Page 75: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

data class User(val name: String)

val jake = User("Jake") println("Hello, $jake!")

Hello, User(name=Jake)!

Page 76: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class UserPersisence(db: SqlDatabase) { private val deleteByName = db.createStatement("DELETE FROM user WHERE name = ?") fun delete(name: String) { deleteByName.bind(1, name) deleteByName.execute() } }

Page 77: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class UserPersisence(db: SqlDatabase) { private val deleteByName = db.createStatement("DELETE FROM user WHERE name = ?") fun delete(name: String) { deleteByName.bind(1, name) deleteByName.execute() }B }A

Page 78: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class UserPersisence(db: SqlDatabase) { private val deleteByName by lazy { db.createStatement("DELETE FROM user WHERE name = ?") }C fun delete(name: String) { deleteByName.bind(1, name) deleteByName.execute() }B }A

Page 79: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val deleteByName by lazy { db.createStatement("DELETE FROM user WHERE name = ?") }C

Page 80: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val deleteByName by lazy { db.createStatement("DELETE FROM user WHERE name = ?") }C

var name by Delegates.observable("Jane") { prop, old, new -> println("Name changed from $old to $new") }

Page 81: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val deleteByName by lazy { db.createStatement("DELETE FROM user WHERE name = ?") }C

var name by Delegates.observable("Jane") { prop, old, new -> println("Name changed from $old to $new") }

var address by Delegates.notNull<String>()

Page 82: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val deleteByName by lazy { db.createStatement("DELETE FROM user WHERE name = ?") }C

var name by Delegates.observable("Jane") { prop, old, new -> println("Name changed from $old to $new") }

var address by Delegates.notNull<String>()

val nameView by bindView<TextView>(R.id.name)

Page 83: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

val deleteByName by lazy { db.createStatement("DELETE FROM user WHERE name = ?") }C

var name by Delegates.observable("Jane") { prop, old, new -> println("Name changed from $old to $new") }

var address by Delegates.notNull<String>()

val nameView by bindView<TextView>(R.id.name)

Page 84: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

fun main(vararg args: String) = runBlocking<Unit> { val jobs = List(100_000) { launch(CommonPool) { delay(1000L) print(".") } } jobs.forEach { it.join() } }

Page 85: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin Author Buildscript Author App Developer

Page 86: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin Author Buildscript AuthorApp Developer

Page 87: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm'

Page 88: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm'

src/ main/ java/ Fizz.java Buzz.java

Page 89: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm'

src/ main/ java/ Fizz.java Buzz.kt

Page 90: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

*.java

*.kt

Page 91: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

*.java

*.kt

kotlinc

Page 92: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

*.java

*.kt

kotlinc

Page 93: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

*.java

*.kt

kotlinc javac

Page 94: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

*.java

*.kt

kotlinc javac

Page 95: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

*.java

*.kt

kotlinc javac

Page 96: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

kotlin-stdlib

*.java

*.kt

kotlinc javac

Page 97: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

kotlin-stdlib

*.java

*.kt

kotlinc javac

Page 98: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

kotlin-stdlib

*.java

*.kt

kotlinc javac

project(':some-library')

Page 99: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm'

Page 100: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm'

apply plugin: 'org.jetbrains.kotlin.android'

Page 101: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm'

apply plugin: 'org.jetbrains.kotlin.android'

apply plugin: 'kotlin2js'

Page 102: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm'

apply plugin: 'org.jetbrains.kotlin.android'

apply plugin: 'kotlin2js'

apply plugin: 'konan' # Different classpath dependency

Page 103: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'org.jetbrains.kotlin.android' apply plugin: 'kotlin2js' apply plugin: 'konan' # Different classpath dependency

or

apply plugin: 'org.jetbrains.kotlin.platform.common'apply plugin: 'org.jetbrains.kotlin.platform.jvm'apply plugin: 'org.jetbrains.kotlin.platform.js'apply plugin: 'konan' # Different classpath dependency

Page 104: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin Author Buildscript Author App Developer

Page 105: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin AuthorBuildscript Author

App Developer

Page 106: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile deps.javaPoet compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 107: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile deps.javaPoet compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 108: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply(plugin: 'org.jetbrains.kotlin.jvm')X apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile deps.javaPoet compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 109: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply(singletonMap('plugin', 'org.jetbrains.kotlin.jvm'))X apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile deps.javaPoet compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 110: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply(singletonMap('plugin', 'org.jetbrains.kotlin.jvm'))X apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile deps.javaPoet compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 111: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply(singletonMap('plugin', 'org.jetbrains.kotlin.jvm'))X apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile deps.javaPoet compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 112: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply(singletonMap('plugin', 'org.jetbrains.kotlin.jvm'))X apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile(deps.javaPoet) compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 113: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply(singletonMap('plugin', 'org.jetbrains.kotlin.jvm'))X apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile(deps.javaPoet) compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }

Page 114: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

android { // ...

testOptions { unitTests.all { systemProperty('robolectric.dependency.repo.id', 'example-nexus') systemProperty('robolectric.dependency.repo.url', 'https://nexus.example.com/content/groups/public') } } }

Page 115: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

android { // ...

testOptions { unitTests.all { systemProperty('robolectric.dependency.repo.id', 'example-nexus') systemProperty('robolectric.dependency.repo.url', 'https://nexus.example.com/content/groups/public') } } }

Page 116: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

android { // ...

testOptions { unitTests.all { systemProperty('robolectric.dependency.repo.id', 'example-nexus') systemProperty('robolectric.dependency.repo.url', 'https://nexus.example.com/content/groups/public') }

}

Page 117: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'org.jetbrains.kotlin.kapt'

sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8

dependencies { compile deps.kotlin.stdLibJre8 compile deps.javaPoet compile deps.autoCommon

compileOnly deps.autoService kapt deps.autoService

testCompile deps.junit testCompile deps.truth testCompile deps.compileTesting }A

java

build.gradle

Page 118: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply { plugin('org.jetbrains.kotlin.jvm') plugin('org.jetbrains.kotlin.kapt') }

java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 }

dependencies { compile(deps.kotlin.stdLibJre8) compile(deps.javaPoet) compile(deps.autoCommon)

compileOnly(deps.autoService) kapt(deps.autoService)

testCompile(deps.junit) testCompile(deps.truth) testCompile(deps.compileTesting) }A

build.gradle.kts

Page 119: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply { plugin('org.jetbrains.kotlin.jvm') plugin('org.jetbrains.kotlin.kapt') }

java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 }

dependencies { compile(deps.kotlin.stdLibJre8) compile(deps.javaPoet) compile(deps.autoCommon)

compileOnly(deps.autoService) kapt(deps.autoService)

testCompile(deps.junit) testCompile(deps.truth) testCompile(deps.compileTesting) }A

build.gradle.kts

Page 120: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply { plugin('org.jetbrains.kotlin.jvm') plugin('org.jetbrains.kotlin.kapt') }

java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 }

dependencies { compile(deps.kotlin.stdLibJre8) compile(deps.javaPoet) compile(deps.autoCommon)

compileOnly(deps.autoService) kapt(deps.autoService)

testCompile(deps.junit) testCompile(deps.truth) testCompile(deps.compileTesting) }A

build.gradle.kts

Page 121: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply { plugin('org.jetbrains.kotlin.jvm') plugin('org.jetbrains.kotlin.kapt') }

java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 }

dependencies { compile(deps.kotlin.stdLibJre8) compile(deps.javaPoet) compile(deps.autoCommon)

compileOnly(deps.autoService) kapt(deps.autoService)

testCompile(deps.junit) testCompile(deps.truth) testCompile(deps.compileTesting) }A

build.gradle.kts

Page 122: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply { plugin('org.jetbrains.kotlin.jvm') plugin('org.jetbrains.kotlin.kapt') }

java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 }

dependencies { compile(deps.kotlin.stdLibJre8) compile(deps.javaPoet) compile(deps.autoCommon)

compileOnly(deps.autoService) kapt(deps.autoService)

testCompile(deps.junit) testCompile(deps.truth) testCompile(deps.compileTesting) }A

build.gradle.kts

Page 123: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

apply { plugin('org.jetbrains.kotlin.jvm') plugin('org.jetbrains.kotlin.kapt') }

java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 }

dependencies { compile(deps.kotlin.stdLibJre8) compile(deps.javaPoet) compile(deps.autoCommon)

compileOnly(deps.autoService) kapt(deps.autoService)

testCompile(deps.junit) testCompile(deps.truth) testCompile(deps.compileTesting) }A

build.gradle.kts

Page 124: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 125: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 126: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin Author Buildscript Author App Developer

Page 127: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

Plugin AuthorBuildscript Author App Developer

Page 128: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

class MyPlugin : Plugin<Project> { override fun apply(project: Project) { // ... }B }A

Page 129: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

import org.gradle.kotlin.dsl.*

class MyPlugin : Plugin<Project> { override fun apply(project: Project) { // ... }B }A

Page 130: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

kotlin-stdlib

*.java

*.kt

kotlinc javac

Page 131: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

kotlin-stdlib

*.java

*.kt

kotlinc javac

apply plugin: 'your-gradle-plugin'

Page 132: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 133: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val
Page 134: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

+

Page 135: A Builder's Intro to Kotlin · A Builder's Intro to Kotlin. Kotlin? Why Kotlin? Plugin Author. Plugin Author Buildscript Author. Plugin Author Buildscript Author App Developer. val

jakewhartonjakewharton

jakewharton

twitter.com/

github.com/

.com

A Builder's Intro to Kotlin