SlideShare a Scribd company logo
1 of 85
Download to read offline
The Feel of Kotlin
Dmitry Jemerov <yole@jetbrains.com>
What’s Kotlin?
What’s Kotlin?
• Statically typed programming language
What’s Kotlin?
• Statically typed programming language
• Targets JVM, Android and Web
What’s Kotlin?
• Statically typed programming language
• Targets JVM, Android and Web
• In development since mid-2010
Why Kotlin?
• Concise
• Expressive
• Safe
• Develop with Pleasure!
Why Not 

<other JVM language>?
Why Not 

<other JVM language>?
• 100% Java interoperability
Why Not 

<other JVM language>?
• 100% Java interoperability
• 100% Java performance
Why Not 

<other JVM language>?
• 100% Java interoperability
• 100% Java performance
• Smooth learning curve
Why Not 

<other JVM language>?
• 100% Java interoperability
• 100% Java performance
• Smooth learning curve
• Maintaining existing investment
Why Not 

<other JVM language>?
• 100% Java interoperability
• 100% Java performance
• Smooth learning curve
• Maintaining existing investment
• Focus on developer tools
Kotlin at JetBrains
Kotlin at JetBrains
• Kotlin itself
Kotlin at JetBrains
• Kotlin itself
• Customer portal
Kotlin at JetBrains
• Kotlin itself
• Customer portal
• Plugins for IntelliJ IDEA, TeamCity
Kotlin at JetBrains
• Kotlin itself
• Customer portal
• Plugins for IntelliJ IDEA, TeamCity
• YouTrack v.next
Kotlin at JetBrains
• Kotlin itself
• Customer portal
• Plugins for IntelliJ IDEA, TeamCity
• YouTrack v.next
• Major new product (unannounced)
Hello World
package helloWorld



fun main(args: Array<String>) {

println("Hello ${args[0]}")

}

Hello World
package helloWorld



fun main(args: Array<String>) {

println("Hello ${args[0]}")

}

Hello World
package helloWorld



fun main(args: Array<String>) {

println("Hello ${args[0]}")

}

Hello World
package helloWorld



fun main(args: Array<String>) {

println("Hello ${args[0]}")

}

Classes
class Person(val firstName: String,

val lastName: String) {



val fullName: String

get() = "$firstName $lastName"

}

Classes
class Person(val firstName: String,

val lastName: String) {



val fullName: String

get() = "$firstName $lastName"

}

Traits and Objects
trait Expr



class Constant(val value: Double) : Expr



class Sum(val op1: Expr, val op2: Expr)

: Expr



object NotANumber : Expr
Traits and Objects
trait Expr



class Constant(val value: Double) : Expr



class Sum(val op1: Expr, val op2: Expr)

: Expr



object NotANumber : Expr
Traits and Objects
trait Expr



class Constant(val value: Double) : Expr



class Sum(val op1: Expr, val op2: Expr)

: Expr



object NotANumber : Expr
Smart Casts
fun eval(e: Expr): Double = when(e) {

is Constant -> e.value

is Sum -> eval(e.op1) + eval(e.op2)

NotANumber -> Double.NaN

else ->
throw IllegalArgumentException()

}
Smart Casts
fun eval(e: Expr): Double = when(e) {

is Constant -> e.value

is Sum -> eval(e.op1) + eval(e.op2)

NotANumber -> Double.NaN

else ->
throw IllegalArgumentException()

}
Smart Casts
fun eval(e: Expr): Double = when(e) {

is Constant -> e.value

is Sum -> eval(e.op1) + eval(e.op2)

NotANumber -> Double.NaN

else ->
throw IllegalArgumentException()

}
Smart Casts
fun eval(e: Expr): Double = when(e) {

is Constant -> e.value

is Sum -> eval(e.op1) + eval(e.op2)

NotANumber -> Double.NaN

else ->
throw IllegalArgumentException()

}
Smart Casts
fun eval(e: Expr): Double = when(e) {

is Constant -> e.value

is Sum -> eval(e.op1) + eval(e.op2)

NotANumber -> Double.NaN

else ->
throw IllegalArgumentException()

}
Extension Functions
fun Expr.eval(): Double = when(this) {

is Constant -> value

is Sum -> op1.eval() + op2.eval()

NotANumber -> Double.NaN

else -> 

throw IllegalArgumentException()

}
Extension Functions
fun Expr.eval(): Double = when(this) {

is Constant -> value

is Sum -> op1.eval() + op2.eval()

NotANumber -> Double.NaN

else -> 

throw IllegalArgumentException()

}
Extension Functions
fun Expr.eval(): Double = when(this) {

is Constant -> value

is Sum -> op1.eval() + op2.eval()

NotANumber -> Double.NaN

else -> 

throw IllegalArgumentException()

}
Operator Overloading
fun Expr.plus(rhs: Expr)

= Sum(this, rhs)



val Double.toExpr: Expr

get() = Constant(this)



fun exprTest() {

val expr = 1.0.toExpr + 2.0.toExpr

println(eval(expr))

}
Operator Overloading
fun Expr.plus(rhs: Expr)

= Sum(this, rhs)



val Double.toExpr: Expr

get() = Constant(this)



fun exprTest() {

val expr = 1.0.toExpr + 2.0.toExpr

println(eval(expr))

}
Operator Overloading
fun Expr.plus(rhs: Expr)

= Sum(this, rhs)



val Double.toExpr: Expr

get() = Constant(this)



fun exprTest() {

val expr = 1.0.toExpr + 2.0.toExpr

println(eval(expr))

}
Operator Overloading
fun Expr.plus(rhs: Expr)

= Sum(this, rhs)



val Double.toExpr: Expr

get() = Constant(this)



fun exprTest() {

val expr = 1.0.toExpr + 2.0.toExpr

println(eval(expr))

}
Operator Overloading
fun Expr.plus(rhs: Expr)

= Sum(this, rhs)



val Double.toExpr: Expr

get() = Constant(this)



fun exprTest() {

val expr = 1.0.toExpr + 2.0.toExpr

println(eval(expr))

}
Nullability
open class TreeNode(val parent: TreeNode?,

val left: TreeNode?,

val right: TreeNode?) {



fun depth(): Int {

val parentDepth = if (parent != null) 

parent.depth()

else

0

return parentDepth + 1

}

}
Nullability
open class TreeNode(val parent: TreeNode?,

val left: TreeNode?,

val right: TreeNode?) {



fun depth(): Int {

val parentDepth = if (parent != null) 

parent.depth()

else

0

return parentDepth + 1

}

}
Nullability
class TreeNode(val parent: TreeNode?,

val left: TreeNode?,

val right: TreeNode?) {



fun depth(): Int {

return (parent?.depth() ?: 0) + 1

}

}

Nullability
class TreeNode(val parent: TreeNode?,

val left: TreeNode?,

val right: TreeNode?) {



fun depth(): Int {

return (parent?.depth() ?: 0) + 1

}

}

Elvis Return
fun TreeNode.isBalanced(): Boolean {

val l = left?.depth() ?: return false

val r = right?.depth() ?: return false

return l == r

}
Default Parameter Values
fun List<String>.join(sep: String = ", ")

: String {



val sb = StringBuilder()

for (i in 0..size()-1) {

if (i > 0) sb.append(sep)

sb.append(this[i])

}

return sb.toString()

}
Default Parameter Values
fun List<String>.join(sep: String = ", ")

: String {



val sb = StringBuilder()

for (i in 0..size()-1) {

if (i > 0) sb.append(sep)

sb.append(this[i])

}

return sb.toString()

}
Default Parameter Values
fun List<String>.join(sep: String = ", ")

: String {



val sb = StringBuilder()

for (i in 0..size()-1) {

if (i > 0) sb.append(sep)

sb.append(this[i])

}

return sb.toString()

}
Maps
val developers = mapOf(

"Kotlin" to "Andrey",

"Python" to "Guido")



fun report() {

for((language, author) in developers) {

println("$author made $language")

}

println("${developers["Kotlin"]} rocks")

}
Maps
val developers = mapOf(

"Kotlin" to "Andrey",

"Python" to "Guido")



fun report() {

for((language, author) in developers) {

println("$author made $language")

}

println("${developers["Kotlin"]} rocks")

}
Maps
val developers = mapOf(

"Kotlin" to "Andrey",

"Python" to "Guido")



fun report() {

for((language, author) in developers) {

println("$author made $language")

}

println("${developers["Kotlin"]} rocks")

}
Maps
val developers = mapOf(

"Kotlin" to "Andrey",

"Python" to "Guido")



fun report() {

for((language, author) in developers) {

println("$author made $language")

}

println("${developers["Kotlin"]} rocks")

}
Collections
fun nobleNames(persons: List<Person>)

= persons

.filter { "von " in it.lastName }

.sortBy { it.firstName }

.map { "${it.firstName} ${it.lastName}” }
Collections
fun nobleNames(persons: List<Person>)

= persons

.filter { "von " in it.lastName }

.sortBy { it.firstName }

.map { "${it.firstName} ${it.lastName}” }
Collections
fun nobleNames(persons: List<Person>)

= persons

.filter { "von " in it.lastName }

.sortBy { it.firstName }

.map { "${it.firstName} ${it.lastName}” }
Collections
fun nobleNames(persons: List<Person>)

= persons

.filter { "von " in it.lastName }

.sortBy { it.firstName }

.map { "${it.firstName} ${it.lastName}” }
Inline Functions
public inline fun <T> 

Iterable<T>.filter(

predicate: (T) -> Boolean): List<T> 

{

val destination = ArrayList<T>() 

for (element in this) {

if (predicate(element)) 

destination.add(element)

}

return destination

}
Inline Functions
public inline fun <T> 

Iterable<T>.filter(

predicate: (T) -> Boolean): List<T> 

{

val destination = ArrayList<T>() 

for (element in this) {

if (predicate(element)) 

destination.add(element)

}

return destination

}
Inline Functions
public inline fun <T> 

Iterable<T>.filter(

predicate: (T) -> Boolean): List<T> 

{

val destination = ArrayList<T>() 

for (element in this) {

if (predicate(element)) 

destination.add(element)

}

return destination

}
Function References
fun nobles(persons: List<Person>)

= persons.filter(::isNoble)


fun isNoble(person: Person)

= person.lastName.startsWith("von ") ||

person.lastName.startsWith("zu ")
Member Extensions
class Person(val firstName: String,

val lastName: String) {



fun isNoble() = lastName.hasNoblePrefix()



fun String.hasNoblePrefix()

= startsWith("von ") ||
startsWith("zu ")

}
Reified Type Parameters
inline fun <reified T>
TreeNode.findParentOfType(): T? {

var p = parent

while (p != null && p !is T) {

p = p?.parent

}

return p as T

}
fun findDirectory(node: TreeNode)

= node.findParentOfType<DirectoryNode>()
Reified Type Parameters
inline fun <reified T>
TreeNode.findParentOfType(): T? {

var p = parent

while (p != null && p !is T) {

p = p?.parent

}

return p as T

}
fun findDirectory(node: TreeNode)

= node.findParentOfType<DirectoryNode>()
Reified Type Parameters
inline fun <reified T>
TreeNode.findParentOfType(): T? {

var p = parent

while (p != null && p !is T) {

p = p?.parent

}

return p as T

}
fun findDirectory(node: TreeNode)

= node.findParentOfType<DirectoryNode>()
Reified Type Parameters
inline fun <reified T>
TreeNode.findParentOfType(): T? {

var p = parent

while (p != null && p !is T) {

p = p?.parent

}

return p as T

}
fun findDirectory(node: TreeNode)

= node.findParentOfType<DirectoryNode>()
HTML Builders
h1 {

+"No Users"

}



p {

+"No users found. Please make sure "

a {

href = TeamRoute("invitations", team)

+"invitation codes"

}

+" are available to eligible users."

}
HTML Builders
h1 {

+"No Users"

}



p {

+"No users found. Please make sure "

a {

href = TeamRoute("invitations", team)

+"invitation codes"

}

+" are available to eligible users."

}
HTML Builders
h1 {

+"No Users"

}



p {

+"No users found. Please make sure "

a {

href = TeamRoute("invitations", team)

+"invitation codes"

}

+" are available to eligible users."

}
Kotlin Tooling
Kotlin Tooling
• IntelliJ plugin since day 0
Kotlin Tooling
• IntelliJ plugin since day 0
• Eclipse plugin just reached alpha
Kotlin Tooling
• IntelliJ plugin since day 0
• Eclipse plugin just reached alpha
• Ant, Maven, Gradle plugins
Kotlin for Android
Kotlin for Android
• Compiler extension to inject views
Kotlin for Android
• Compiler extension to inject views
• Builder DSL to construct user interfaces
Kotlin for Android
• Compiler extension to inject views
• Builder DSL to construct user interfaces
• Fully compatible with Android Studio
Status of Kotlin
Status of Kotlin
• Compiler and IntelliJ IDEA plugin stable and
production-ready
Status of Kotlin
• Compiler and IntelliJ IDEA plugin stable and
production-ready
• Finalizing design of language and standard library
Status of Kotlin
• Compiler and IntelliJ IDEA plugin stable and
production-ready
• Finalizing design of language and standard library
• Expecting 1.0 release later this year
Summary
Summary
• Kotlin is safe, concise and expressive
Summary
• Kotlin is safe, concise and expressive
• Kotlin can be gradually introduced in any existing
Java project
Summary
• Kotlin is safe, concise and expressive
• Kotlin can be gradually introduced in any existing
Java project
• Kotlin is stable and ready for production use
Q&A
http://kotlinlang.org/
@intelliyole
yole@jetbrains.com

More Related Content

What's hot

Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?intelliyole
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Languageintelliyole
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersBartosz Kosarzycki
 
Kotlin as a Better Java
Kotlin as a Better JavaKotlin as a Better Java
Kotlin as a Better JavaGarth Gilmour
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinAndrey Breslav
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldBTI360
 
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...eMan s.r.o.
 
Demystifying functional programming with Scala
Demystifying functional programming with ScalaDemystifying functional programming with Scala
Demystifying functional programming with ScalaDenis
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Cody Engel
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Jonas Bonér
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardMario Fusco
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 
Kotlin collections
Kotlin collectionsKotlin collections
Kotlin collectionsMyeongin Woo
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsBartosz Kosarzycki
 
Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Andrey Breslav
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойSigma Software
 

What's hot (20)

Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 
Kotlin as a Better Java
Kotlin as a Better JavaKotlin as a Better Java
Kotlin as a Better Java
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in Kotlin
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 World
 
Kotlin intro
Kotlin introKotlin intro
Kotlin intro
 
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
 
Demystifying functional programming with Scala
Demystifying functional programming with ScalaDemystifying functional programming with Scala
Demystifying functional programming with Scala
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
Hammurabi
HammurabiHammurabi
Hammurabi
 
Joy of scala
Joy of scalaJoy of scala
Joy of scala
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Kotlin collections
Kotlin collectionsKotlin collections
Kotlin collections
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 
Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
 
Kotlin
KotlinKotlin
Kotlin
 

Similar to Kotlin Language Features and Benefits

Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kirill Rozov
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala LanguageAshal aka JOKER
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)William Narmontas
 
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdfAndrey Breslav
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meetMario Fusco
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with GroovyArturo Herrero
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Mohamed Nabil, MSc.
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?Tomasz Wrobel
 
Hello kotlin | An Event by DSC Unideb
Hello kotlin | An Event by DSC UnidebHello kotlin | An Event by DSC Unideb
Hello kotlin | An Event by DSC UnidebMuhammad Raza
 
What's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageWhat's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageDroidConTLV
 
Scala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldScala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldWerner Hofstra
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfHiroshi Ono
 

Similar to Kotlin Language Features and Benefits (20)

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
 
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
 
Scala
ScalaScala
Scala
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
Benefits of Kotlin
Benefits of KotlinBenefits of Kotlin
Benefits of Kotlin
 
Kotlin
KotlinKotlin
Kotlin
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?
 
Hello kotlin | An Event by DSC Unideb
Hello kotlin | An Event by DSC UnidebHello kotlin | An Event by DSC Unideb
Hello kotlin | An Event by DSC Unideb
 
Kotlin decompiled
Kotlin decompiledKotlin decompiled
Kotlin decompiled
 
What's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritageWhat's in Kotlin for us - Alexandre Greschon, MyHeritage
What's in Kotlin for us - Alexandre Greschon, MyHeritage
 
Scala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereldScala: Functioneel programmeren in een object georiënteerde wereld
Scala: Functioneel programmeren in een object georiënteerde wereld
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
 
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdfpragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
 

More from intelliyole

From Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDEFrom Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDEintelliyole
 
How to Build Developer Tools on Top of IntelliJ Platform
How to Build Developer Tools on Top of IntelliJ PlatformHow to Build Developer Tools on Top of IntelliJ Platform
How to Build Developer Tools on Top of IntelliJ Platformintelliyole
 
IntelliJ IDEA: Life after Open Source
IntelliJ IDEA: Life after Open SourceIntelliJ IDEA: Life after Open Source
IntelliJ IDEA: Life after Open Sourceintelliyole
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLsintelliyole
 
Implementing Refactorings in IntelliJ IDEA
Implementing Refactorings in IntelliJ IDEAImplementing Refactorings in IntelliJ IDEA
Implementing Refactorings in IntelliJ IDEAintelliyole
 
IntelliJ IDEA Architecture and Performance
IntelliJ IDEA Architecture and PerformanceIntelliJ IDEA Architecture and Performance
IntelliJ IDEA Architecture and Performanceintelliyole
 

More from intelliyole (6)

From Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDEFrom Renamer Plugin to Polyglot IDE
From Renamer Plugin to Polyglot IDE
 
How to Build Developer Tools on Top of IntelliJ Platform
How to Build Developer Tools on Top of IntelliJ PlatformHow to Build Developer Tools on Top of IntelliJ Platform
How to Build Developer Tools on Top of IntelliJ Platform
 
IntelliJ IDEA: Life after Open Source
IntelliJ IDEA: Life after Open SourceIntelliJ IDEA: Life after Open Source
IntelliJ IDEA: Life after Open Source
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Implementing Refactorings in IntelliJ IDEA
Implementing Refactorings in IntelliJ IDEAImplementing Refactorings in IntelliJ IDEA
Implementing Refactorings in IntelliJ IDEA
 
IntelliJ IDEA Architecture and Performance
IntelliJ IDEA Architecture and PerformanceIntelliJ IDEA Architecture and Performance
IntelliJ IDEA Architecture and Performance
 

Recently uploaded

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Recently uploaded (20)

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

Kotlin Language Features and Benefits

  • 1. The Feel of Kotlin Dmitry Jemerov <yole@jetbrains.com>
  • 3. What’s Kotlin? • Statically typed programming language
  • 4. What’s Kotlin? • Statically typed programming language • Targets JVM, Android and Web
  • 5. What’s Kotlin? • Statically typed programming language • Targets JVM, Android and Web • In development since mid-2010
  • 6. Why Kotlin? • Concise • Expressive • Safe • Develop with Pleasure!
  • 7. Why Not 
 <other JVM language>?
  • 8. Why Not 
 <other JVM language>? • 100% Java interoperability
  • 9. Why Not 
 <other JVM language>? • 100% Java interoperability • 100% Java performance
  • 10. Why Not 
 <other JVM language>? • 100% Java interoperability • 100% Java performance • Smooth learning curve
  • 11. Why Not 
 <other JVM language>? • 100% Java interoperability • 100% Java performance • Smooth learning curve • Maintaining existing investment
  • 12. Why Not 
 <other JVM language>? • 100% Java interoperability • 100% Java performance • Smooth learning curve • Maintaining existing investment • Focus on developer tools
  • 14. Kotlin at JetBrains • Kotlin itself
  • 15. Kotlin at JetBrains • Kotlin itself • Customer portal
  • 16. Kotlin at JetBrains • Kotlin itself • Customer portal • Plugins for IntelliJ IDEA, TeamCity
  • 17. Kotlin at JetBrains • Kotlin itself • Customer portal • Plugins for IntelliJ IDEA, TeamCity • YouTrack v.next
  • 18. Kotlin at JetBrains • Kotlin itself • Customer portal • Plugins for IntelliJ IDEA, TeamCity • YouTrack v.next • Major new product (unannounced)
  • 19. Hello World package helloWorld
 
 fun main(args: Array<String>) {
 println("Hello ${args[0]}")
 }

  • 20. Hello World package helloWorld
 
 fun main(args: Array<String>) {
 println("Hello ${args[0]}")
 }

  • 21. Hello World package helloWorld
 
 fun main(args: Array<String>) {
 println("Hello ${args[0]}")
 }

  • 22. Hello World package helloWorld
 
 fun main(args: Array<String>) {
 println("Hello ${args[0]}")
 }

  • 23. Classes class Person(val firstName: String,
 val lastName: String) {
 
 val fullName: String
 get() = "$firstName $lastName"
 }

  • 24. Classes class Person(val firstName: String,
 val lastName: String) {
 
 val fullName: String
 get() = "$firstName $lastName"
 }

  • 25. Traits and Objects trait Expr
 
 class Constant(val value: Double) : Expr
 
 class Sum(val op1: Expr, val op2: Expr)
 : Expr
 
 object NotANumber : Expr
  • 26. Traits and Objects trait Expr
 
 class Constant(val value: Double) : Expr
 
 class Sum(val op1: Expr, val op2: Expr)
 : Expr
 
 object NotANumber : Expr
  • 27. Traits and Objects trait Expr
 
 class Constant(val value: Double) : Expr
 
 class Sum(val op1: Expr, val op2: Expr)
 : Expr
 
 object NotANumber : Expr
  • 28. Smart Casts fun eval(e: Expr): Double = when(e) {
 is Constant -> e.value
 is Sum -> eval(e.op1) + eval(e.op2)
 NotANumber -> Double.NaN
 else -> throw IllegalArgumentException()
 }
  • 29. Smart Casts fun eval(e: Expr): Double = when(e) {
 is Constant -> e.value
 is Sum -> eval(e.op1) + eval(e.op2)
 NotANumber -> Double.NaN
 else -> throw IllegalArgumentException()
 }
  • 30. Smart Casts fun eval(e: Expr): Double = when(e) {
 is Constant -> e.value
 is Sum -> eval(e.op1) + eval(e.op2)
 NotANumber -> Double.NaN
 else -> throw IllegalArgumentException()
 }
  • 31. Smart Casts fun eval(e: Expr): Double = when(e) {
 is Constant -> e.value
 is Sum -> eval(e.op1) + eval(e.op2)
 NotANumber -> Double.NaN
 else -> throw IllegalArgumentException()
 }
  • 32. Smart Casts fun eval(e: Expr): Double = when(e) {
 is Constant -> e.value
 is Sum -> eval(e.op1) + eval(e.op2)
 NotANumber -> Double.NaN
 else -> throw IllegalArgumentException()
 }
  • 33. Extension Functions fun Expr.eval(): Double = when(this) {
 is Constant -> value
 is Sum -> op1.eval() + op2.eval()
 NotANumber -> Double.NaN
 else -> 
 throw IllegalArgumentException()
 }
  • 34. Extension Functions fun Expr.eval(): Double = when(this) {
 is Constant -> value
 is Sum -> op1.eval() + op2.eval()
 NotANumber -> Double.NaN
 else -> 
 throw IllegalArgumentException()
 }
  • 35. Extension Functions fun Expr.eval(): Double = when(this) {
 is Constant -> value
 is Sum -> op1.eval() + op2.eval()
 NotANumber -> Double.NaN
 else -> 
 throw IllegalArgumentException()
 }
  • 36. Operator Overloading fun Expr.plus(rhs: Expr)
 = Sum(this, rhs)
 
 val Double.toExpr: Expr
 get() = Constant(this)
 
 fun exprTest() {
 val expr = 1.0.toExpr + 2.0.toExpr
 println(eval(expr))
 }
  • 37. Operator Overloading fun Expr.plus(rhs: Expr)
 = Sum(this, rhs)
 
 val Double.toExpr: Expr
 get() = Constant(this)
 
 fun exprTest() {
 val expr = 1.0.toExpr + 2.0.toExpr
 println(eval(expr))
 }
  • 38. Operator Overloading fun Expr.plus(rhs: Expr)
 = Sum(this, rhs)
 
 val Double.toExpr: Expr
 get() = Constant(this)
 
 fun exprTest() {
 val expr = 1.0.toExpr + 2.0.toExpr
 println(eval(expr))
 }
  • 39. Operator Overloading fun Expr.plus(rhs: Expr)
 = Sum(this, rhs)
 
 val Double.toExpr: Expr
 get() = Constant(this)
 
 fun exprTest() {
 val expr = 1.0.toExpr + 2.0.toExpr
 println(eval(expr))
 }
  • 40. Operator Overloading fun Expr.plus(rhs: Expr)
 = Sum(this, rhs)
 
 val Double.toExpr: Expr
 get() = Constant(this)
 
 fun exprTest() {
 val expr = 1.0.toExpr + 2.0.toExpr
 println(eval(expr))
 }
  • 41. Nullability open class TreeNode(val parent: TreeNode?,
 val left: TreeNode?,
 val right: TreeNode?) {
 
 fun depth(): Int {
 val parentDepth = if (parent != null) 
 parent.depth()
 else
 0
 return parentDepth + 1
 }
 }
  • 42. Nullability open class TreeNode(val parent: TreeNode?,
 val left: TreeNode?,
 val right: TreeNode?) {
 
 fun depth(): Int {
 val parentDepth = if (parent != null) 
 parent.depth()
 else
 0
 return parentDepth + 1
 }
 }
  • 43. Nullability class TreeNode(val parent: TreeNode?,
 val left: TreeNode?,
 val right: TreeNode?) {
 
 fun depth(): Int {
 return (parent?.depth() ?: 0) + 1
 }
 }

  • 44. Nullability class TreeNode(val parent: TreeNode?,
 val left: TreeNode?,
 val right: TreeNode?) {
 
 fun depth(): Int {
 return (parent?.depth() ?: 0) + 1
 }
 }

  • 45. Elvis Return fun TreeNode.isBalanced(): Boolean {
 val l = left?.depth() ?: return false
 val r = right?.depth() ?: return false
 return l == r
 }
  • 46. Default Parameter Values fun List<String>.join(sep: String = ", ")
 : String {
 
 val sb = StringBuilder()
 for (i in 0..size()-1) {
 if (i > 0) sb.append(sep)
 sb.append(this[i])
 }
 return sb.toString()
 }
  • 47. Default Parameter Values fun List<String>.join(sep: String = ", ")
 : String {
 
 val sb = StringBuilder()
 for (i in 0..size()-1) {
 if (i > 0) sb.append(sep)
 sb.append(this[i])
 }
 return sb.toString()
 }
  • 48. Default Parameter Values fun List<String>.join(sep: String = ", ")
 : String {
 
 val sb = StringBuilder()
 for (i in 0..size()-1) {
 if (i > 0) sb.append(sep)
 sb.append(this[i])
 }
 return sb.toString()
 }
  • 49. Maps val developers = mapOf(
 "Kotlin" to "Andrey",
 "Python" to "Guido")
 
 fun report() {
 for((language, author) in developers) {
 println("$author made $language")
 }
 println("${developers["Kotlin"]} rocks")
 }
  • 50. Maps val developers = mapOf(
 "Kotlin" to "Andrey",
 "Python" to "Guido")
 
 fun report() {
 for((language, author) in developers) {
 println("$author made $language")
 }
 println("${developers["Kotlin"]} rocks")
 }
  • 51. Maps val developers = mapOf(
 "Kotlin" to "Andrey",
 "Python" to "Guido")
 
 fun report() {
 for((language, author) in developers) {
 println("$author made $language")
 }
 println("${developers["Kotlin"]} rocks")
 }
  • 52. Maps val developers = mapOf(
 "Kotlin" to "Andrey",
 "Python" to "Guido")
 
 fun report() {
 for((language, author) in developers) {
 println("$author made $language")
 }
 println("${developers["Kotlin"]} rocks")
 }
  • 53. Collections fun nobleNames(persons: List<Person>)
 = persons
 .filter { "von " in it.lastName }
 .sortBy { it.firstName }
 .map { "${it.firstName} ${it.lastName}” }
  • 54. Collections fun nobleNames(persons: List<Person>)
 = persons
 .filter { "von " in it.lastName }
 .sortBy { it.firstName }
 .map { "${it.firstName} ${it.lastName}” }
  • 55. Collections fun nobleNames(persons: List<Person>)
 = persons
 .filter { "von " in it.lastName }
 .sortBy { it.firstName }
 .map { "${it.firstName} ${it.lastName}” }
  • 56. Collections fun nobleNames(persons: List<Person>)
 = persons
 .filter { "von " in it.lastName }
 .sortBy { it.firstName }
 .map { "${it.firstName} ${it.lastName}” }
  • 57. Inline Functions public inline fun <T> 
 Iterable<T>.filter(
 predicate: (T) -> Boolean): List<T> 
 {
 val destination = ArrayList<T>() 
 for (element in this) {
 if (predicate(element)) 
 destination.add(element)
 }
 return destination
 }
  • 58. Inline Functions public inline fun <T> 
 Iterable<T>.filter(
 predicate: (T) -> Boolean): List<T> 
 {
 val destination = ArrayList<T>() 
 for (element in this) {
 if (predicate(element)) 
 destination.add(element)
 }
 return destination
 }
  • 59. Inline Functions public inline fun <T> 
 Iterable<T>.filter(
 predicate: (T) -> Boolean): List<T> 
 {
 val destination = ArrayList<T>() 
 for (element in this) {
 if (predicate(element)) 
 destination.add(element)
 }
 return destination
 }
  • 60. Function References fun nobles(persons: List<Person>)
 = persons.filter(::isNoble) 
 fun isNoble(person: Person)
 = person.lastName.startsWith("von ") ||
 person.lastName.startsWith("zu ")
  • 61. Member Extensions class Person(val firstName: String,
 val lastName: String) {
 
 fun isNoble() = lastName.hasNoblePrefix()
 
 fun String.hasNoblePrefix()
 = startsWith("von ") || startsWith("zu ")
 }
  • 62. Reified Type Parameters inline fun <reified T> TreeNode.findParentOfType(): T? {
 var p = parent
 while (p != null && p !is T) {
 p = p?.parent
 }
 return p as T
 } fun findDirectory(node: TreeNode)
 = node.findParentOfType<DirectoryNode>()
  • 63. Reified Type Parameters inline fun <reified T> TreeNode.findParentOfType(): T? {
 var p = parent
 while (p != null && p !is T) {
 p = p?.parent
 }
 return p as T
 } fun findDirectory(node: TreeNode)
 = node.findParentOfType<DirectoryNode>()
  • 64. Reified Type Parameters inline fun <reified T> TreeNode.findParentOfType(): T? {
 var p = parent
 while (p != null && p !is T) {
 p = p?.parent
 }
 return p as T
 } fun findDirectory(node: TreeNode)
 = node.findParentOfType<DirectoryNode>()
  • 65. Reified Type Parameters inline fun <reified T> TreeNode.findParentOfType(): T? {
 var p = parent
 while (p != null && p !is T) {
 p = p?.parent
 }
 return p as T
 } fun findDirectory(node: TreeNode)
 = node.findParentOfType<DirectoryNode>()
  • 66. HTML Builders h1 {
 +"No Users"
 }
 
 p {
 +"No users found. Please make sure "
 a {
 href = TeamRoute("invitations", team)
 +"invitation codes"
 }
 +" are available to eligible users."
 }
  • 67. HTML Builders h1 {
 +"No Users"
 }
 
 p {
 +"No users found. Please make sure "
 a {
 href = TeamRoute("invitations", team)
 +"invitation codes"
 }
 +" are available to eligible users."
 }
  • 68. HTML Builders h1 {
 +"No Users"
 }
 
 p {
 +"No users found. Please make sure "
 a {
 href = TeamRoute("invitations", team)
 +"invitation codes"
 }
 +" are available to eligible users."
 }
  • 70. Kotlin Tooling • IntelliJ plugin since day 0
  • 71. Kotlin Tooling • IntelliJ plugin since day 0 • Eclipse plugin just reached alpha
  • 72. Kotlin Tooling • IntelliJ plugin since day 0 • Eclipse plugin just reached alpha • Ant, Maven, Gradle plugins
  • 74. Kotlin for Android • Compiler extension to inject views
  • 75. Kotlin for Android • Compiler extension to inject views • Builder DSL to construct user interfaces
  • 76. Kotlin for Android • Compiler extension to inject views • Builder DSL to construct user interfaces • Fully compatible with Android Studio
  • 78. Status of Kotlin • Compiler and IntelliJ IDEA plugin stable and production-ready
  • 79. Status of Kotlin • Compiler and IntelliJ IDEA plugin stable and production-ready • Finalizing design of language and standard library
  • 80. Status of Kotlin • Compiler and IntelliJ IDEA plugin stable and production-ready • Finalizing design of language and standard library • Expecting 1.0 release later this year
  • 82. Summary • Kotlin is safe, concise and expressive
  • 83. Summary • Kotlin is safe, concise and expressive • Kotlin can be gradually introduced in any existing Java project
  • 84. Summary • Kotlin is safe, concise and expressive • Kotlin can be gradually introduced in any existing Java project • Kotlin is stable and ready for production use