Kevin Jones kevinrocksolidknowledgecom kevinrjones What Is Kotiln JVM Language Supports immutability Abhors nulls Object oriented Functional Less cermony than Java You Can Just Code ID: 583554
Download Presentation The PPT/PDF document "An introduction to Kotlin" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
An introduction to Kotlin
Kevin Jones
kevin@rocksolidknowledge.com
@
kevinrjonesSlide2
What Is Kotiln
JVM Language
Supports immutability
Abhors nullsObject orientedFunctionalLess cermony than JavaSlide3
You Can Just Code
fun main(
args
: Array<String>) {
println
("Hello, World")
}Slide4
Immutability
val
name:String
= "Kevin"
val
name = "Kevin"
var
password:StringSlide5
Templates
val
name = "Kevin"
print("My name is $name")Slide6
Defining Classes
class Person {
val
name:String
val
numberOfChildren
:
Int
}Slide7
Functions
Don't need to be part of a class
Are introduced with the 'fun' keyword
Can have default parametersCan have named parametersCan 'extend' existing typesinfixoperator overloadingtailrecSlide8
Programming With Types
Interfaces
Classes
final by defaultInheritanceConstructionData ClassesSlide9
object keyword
object
companion objectSlide10
High level functions
Lambdas
'with' and 'apply'
closuresSlide11
Filtering and Sorting
map
flatMap
filterpredicatesSlide12
Infinite Collections
Sequences in KotlinSlide13
Kotlin and null
Nullable types
Safe call
'Elvis'Safe cast!!letlateinitSlide14
Kotlin Collections
listOf
mutableListOf
…Slide15
Higher Order Functions
Inlining
noinlineSlide16
Generics
ReificationSlide17
Summary
A better Java
A better C#?