날이 갈수록 쏟아지는 모던 프로그래밍 언어들, 안드로이드 앱 개발자에겐 꿈과 같은 이야기였다고요? 이제는 더 이상 꿈이 아닙니다.
이 세션에서는 구글 I/O 2017에서 안드로이드의 공식 지원 언어로 발표된 코틀린에 대해 간략히 알아보고, 실제 애플리케이션에 적용한 사례를 함께 소개합니다.
Google I/O 2017 Extended Seoul
2017.07.02
26. Extended
Seoul
I call it my billion-dollar mistake. This has
led to innumerable errors … probably
caused a billion dollars of pain and damage
in the last forty years.
Extended
Seoul
- Tony Hoare
59. Collections.kt
val mutableList : MutableList<String>
= mutableListOf(“foo", "bar", "baz")
mutableList.add("fizz")
val immutableList : List<String>
= listOf("foo", "bar", "baz")
immutableList.add("fizz")
60. Collections.kt
val mutableList : MutableList<String>
= mutableListOf(“foo", "bar", "baz")
mutableList.add("fizz")
val immutableList : List<String>
= listOf("foo", "bar", "baz")
immutableList.add("fizz")
61. Collections.kt
val emptyStringList = listOf<String>()
val cities = listOf("Seoul", "Busan")
val mutableCities = mutableListOf("Seoul, Busan")
val emptyStringSet = setOf<String>()
val cities = setOf("Seoul", "Busan")
val mutableCities = mutableSetOf("Seoul, Busan")
68. MyToast.kt
// Define an extension function on Context
fun Context.toast(message: String) {
Toast.makeText(this.applicationContext,
message, Toast.LENGTH_SHORT).show()
}
// available in class Context and its descendants
toast("Hello, Kotlin!")