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入門しました
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
720
Wantedly のバックエンドの将来に向けた取り組みと課題 - Wantedly Tech Night 2024/5
gedorinku
0
160
Porting mruby/c for the SNES (Super Famicom) - RubyKaigi 2024
gedorinku
0
4.9k
N+1 問題の解決と computed_model
gedorinku
0
130
部内での競プロ用ジャッジシステム
gedorinku
0
1.8k
部内ジャッジを作る話
gedorinku
1
130
プロラボ年度末報告会 HackDay / Hack U 福岡
gedorinku
0
180
Other Decks in Programming
See All in Programming
Cloudflare is Agents
chimame
0
160
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
230
プロポーザルを書いてもらう
pvcresin
0
510
Google Apps Script で Ruby を動かす
kawahara
0
220
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
170
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
220
「人を評価する AI」の設計と実装
ryoyanara
0
200
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
3
790
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
230
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
430
メールのエイリアス機能を履き違えない
isshinfunada
0
240
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Raft: Consensus for Rubyists
vanstee
141
7.6k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Chasing Engaging Ingredients in Design
codingconduct
0
270
How to make the Groovebox
asonas
2
2.3k
Claude Code のすすめ
schroneko
67
230k
The Curse of the Amulet
leimatthew05
2
14k
Navigating Team Friction
lara
192
16k
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を はじめましょう