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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
gedorinku
March 24, 2017
Programming
280
0
Share
Kotlin入門しました
#prolabLT のスライドです.
gedorinku
March 24, 2017
More Decks by gedorinku
See All by gedorinku
Active Record Encryption と AWS KMS でエンベロープ暗号化
gedorinku
0
640
Wantedly のバックエンドの将来に向けた取り組みと課題 - Wantedly Tech Night 2024/5
gedorinku
0
150
Porting mruby/c for the SNES (Super Famicom) - RubyKaigi 2024
gedorinku
0
4.7k
N+1 問題の解決と computed_model
gedorinku
0
110
部内での競プロ用ジャッジシステム
gedorinku
0
1.8k
部内ジャッジを作る話
gedorinku
1
110
プロラボ年度末報告会 HackDay / Hack U 福岡
gedorinku
0
170
Other Decks in Programming
See All in Programming
見せてもらおうか、 OpenSearchの性能とやらを!
shunta27
1
160
「速くなった気がする」をデータで疑う
senleaf24
0
110
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
110
Claude Code Skill入門
mayahoney
0
450
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
180
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
270
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
260
How to stabilize UI tests using XCTest
akkeylab
0
150
存在論的プログラミング: 時間と存在を記述する
koriym
5
590
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.3k
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
1.2k
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
130
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
200
Marketing to machines
jonoalderson
1
5.1k
WENDY [Excerpt]
tessaabrams
9
37k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
240
Automating Front-end Workflow
addyosmani
1370
200k
Accessibility Awareness
sabderemane
0
88
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Claude Code のすすめ
schroneko
67
220k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Abbi's Birthday
coloredviolet
2
6.1k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
440
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を はじめましょう