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
290
0
Share
Kotlin入門しました
#prolabLT のスライドです.
gedorinku
March 24, 2017
More Decks by gedorinku
See All by gedorinku
Active Record Encryption と AWS KMS でエンベロープ暗号化
gedorinku
0
660
Wantedly のバックエンドの将来に向けた取り組みと課題 - Wantedly Tech Night 2024/5
gedorinku
0
160
Porting mruby/c for the SNES (Super Famicom) - RubyKaigi 2024
gedorinku
0
4.8k
N+1 問題の解決と computed_model
gedorinku
0
120
部内での競プロ用ジャッジシステム
gedorinku
0
1.8k
部内ジャッジを作る話
gedorinku
1
120
プロラボ年度末報告会 HackDay / Hack U 福岡
gedorinku
0
170
Other Decks in Programming
See All in Programming
実用!Hono RPC2026
yodaka
2
310
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
1.2k
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
770
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
160
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
23
13k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
350
Skillは並べた。動かなかった。契約で繋いだ。— 65個のSkillから、自走する開発サイクルへ
junholee
0
580
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
450
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
1
170
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.8k
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
280
Featured
See All Featured
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Docker and Python
trallard
47
3.8k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
170
Visualization
eitanlees
151
17k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
110
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
200
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
From π to Pie charts
rasagy
0
180
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
190
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を はじめましょう