Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin sintax overview
Search
Felipe Oliveira
April 30, 2016
Programming
0
77
Kotlin sintax overview
This talk is result of my presentation on AndroidStudyJams Maceió
Felipe Oliveira
April 30, 2016
Tweet
Share
More Decks by Felipe Oliveira
See All by Felipe Oliveira
Validação com Android Saripaar 2
oliveiradev
0
80
Other Decks in Programming
See All in Programming
入門 AWS Amplify Gen2 / Introduction to AWS Amplify Gen2
genkiogasawara
1
310
Changed Rules: Architectures with Lightweight Stores
manfredsteyer
PRO
0
230
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
280
コードレビューで学ぶ!Kotlinオブジェクト指向デザインパターン
akkie76
2
180
デザインシステムで Tailwind CSSとCSS in JSに分散投資をしたら良かった話
fsubal
18
4.8k
SpringBoot+MyBatisで例外が出たときどこを見るか
syukai
0
110
[技育CAMPアカデミア]アイディアを形に!【超入門】スマホアプリ開発〜リリースまでの流れをご紹介
teamlab
PRO
0
340
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
25
7.8k
Ruby Function Composition
bkuhlmann
1
330
Javaエンジニアのための Nodejs/Nuxt3入門
hidekatsu_izuno
0
280
Ruby Pattern Matching
bkuhlmann
0
920
Git Lint
bkuhlmann
4
740
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
513
39k
Navigating Team Friction
lara
177
13k
How to train your dragon (web standard)
notwaldorf
72
5.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.5k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Debugging Ruby Performance
tmm1
70
11k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
GitHub's CSS Performance
jonrohan
1023
450k
BBQ
matthewcrist
80
8.7k
Teambox: Starting and Learning
jrom
128
8.4k
Code Review Best Practice
trishagee
54
15k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
Transcript
Kotlin for Android Felipe Oliveira oliveiradev
Felipe Oliveira
Linguagem foi criada pela JetBrains, Kotlin roda na JVM e
é 100% interoperável com Java.
None
Sintaxe overview: atributos
Sintaxe overview: métodos
Sintaxe overview: classes class Person {} open class Person {}
data class Person(val name: String, val age: Int)
Sintaxe overview: Null safety val person: Person? = Person("Felipe",24) fun
main(args: Array<String>) { print(person?.name) }
Sintaxe overview: Default arguments fun query(table: String, columns: Array<String>, orderBy:
String? = null, limit: Int? = null){ ... } query("PEOPLE", arrayOf("ID","NAME")) query("PEOPLE", arrayOf("ID","NAME") , limit = 10)
Sintaxe overview: Extension functions fun ImageView.loadForUrl(url: String){ Picasso.with(context).load(url).into(this) } //single
expression sintax fun String.hello() = "Hello $this"
Sintaxe overview: When expression when(value){ is String -> print("eh String")
else -> print("n eh String") }
Sintaxe overview: Smart cast if (value is String){ print(value.length) }
Instalando plugin no Android Studio apply plugin: 'kotlin-android' android {
... sourceSets { main.java.srcDirs += 'src/main/kotlin' } ... } dependencies { ... compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" ... } buildscript { ext.kotlin_version = '1.0.1-2' repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }
Referências Jake Wharton https://plus.google.com/+JakeWharton/posts/WSCoqkJ5MBj Kotlin lang docs reference https://kotlinlang.org/docs/reference Antonio
Leiva Blog http://antonioleiva.com/kotlin/ Comece agora a brincar com kotlin http://try.kotlinlang.org/