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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
gedorinku
March 24, 2017
Programming
0
280
Kotlin入門しました
#prolabLT のスライドです.
gedorinku
March 24, 2017
Tweet
Share
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
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
550
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
3
1.8k
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
200
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
920
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
410
CSC307 Lecture 15
javiergs
PRO
0
260
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
390
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
150
CSC307 Lecture 14
javiergs
PRO
0
480
Java 21/25 Virtual Threads 소개
debop
0
240
Ruby and LLM Ecosystem 2nd
koic
1
1.2k
Migration to Signals, Signal Forms, Resource API, and NgRx Signal Store @Angular Days 03/2026 Munich
manfredsteyer
PRO
0
130
Featured
See All Featured
Abbi's Birthday
coloredviolet
2
5.6k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
160
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
410
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
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を はじめましょう