Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Kotlin入門しました
Search
gedorinku
March 24, 2017
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kotlin入門しました
#prolabLT のスライドです.
gedorinku
March 24, 2017
More Decks by gedorinku
See All by gedorinku
Active Record Encryption と AWS KMS でエンベロープ暗号化
gedorinku
0
790
Wantedly のバックエンドの将来に向けた取り組みと課題 - Wantedly Tech Night 2024/5
gedorinku
0
180
Porting mruby/c for the SNES (Super Famicom) - RubyKaigi 2024
gedorinku
0
5k
N+1 問題の解決と computed_model
gedorinku
0
140
部内での競プロ用ジャッジシステム
gedorinku
0
1.8k
部内ジャッジを作る話
gedorinku
1
130
プロラボ年度末報告会 HackDay / Hack U 福岡
gedorinku
0
180
Other Decks in Programming
See All in Programming
R8 の設定見直しでアプリサイズ削減
andpad
0
210
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
200
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.5k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
260
Simple Storage Service(S3) is not simple
iwatsukayura
0
280
contenteditable と日本語入力に向き合う
colorful12
0
200
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
740
Workers Cache を知る
syumai
0
360
Railsバージョンを4倍にした話
optim
0
260
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
110
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
140
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Optimising Largest Contentful Paint
csswizardry
37
4k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
How GitHub (no longer) Works
holman
316
150k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
520
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Thoughts on Productivity
jonyablonski
76
5.4k
Building the Perfect Custom Keyboard
takai
2
900
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
So, you think you're a good person
axbom
PRO
2
2.2k
Transcript
Kotlin入門しました @gedorinku
Kotlin #とは • JetBrainsが作った言語 • JVMで動く • Androidでも使える • 安全で簡潔な記述ができる
• null安全 • SAM変換 • 拡張関数 • delegation とか • 名前がかわいい
null安全ー?なにそれー? JavaやKotlinはnullを参照すると ぬるぽ(NullPointerException)で止まる 回避するにはnullを参照しようとしてないか 頑張ってチェックする・・・?
null許容型・非null型 fun main(args: Array<String>) { var hoge: Array<Int> = null
var piyo: Array<Int>? = null //something to do val evenCount = piyo?.count { it % 2 == 0 } ?: 0 } ←コンパイルエラー ←OK null許容型はnullチェックして参照しないとコンパイルエラー
Javaとの連携とSAM変換 val runnable = Runnable { println("hogehoge") } KotlinからJavaのクラスは普通に使える 抽象メソッド1つを実装した匿名クラスは簡潔に書ける
(Java8っぽい)
拡張関数・拡張プロパティ 既存のクラスに後からメソッドを追加する機能 fun String.chan(): String = this + "-chan" println("Serval".chan())
//-> Serval-chan
キモイことができます operator fun Int.invoke(): Int = this * 2 fun
Int.println() = println(this) 1()()().println() //-> 8
既存のクラスに後からメソッドを追加する機能 //-> [0, 8, 16] fun Array<Int>.applyMany( times: Int, f:
Array<Int>.() -> Unit ): Array<Int> { for (i in 1..times) { f() } return this } fun main(args: Array<String>) { println(arrayOf(0, 1, 2).applyMany(3) { forEachIndexed { index, i -> this[index] = i * 2 } }.toList()) }
Kotlin Koans IDEを使って チュートリアルをやると 幸せになれる 全部理解できたらプロ.
Kotlin Koans Kotlin Koansを進めると, いい感じのgif付きで ツイートできる Kotlin KoansでKotlinを はじめましょう