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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
mattak
October 08, 2015
Technology
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
かゆいところに手が届くKotlin
Kotlin's 8 tips.
mattak
October 08, 2015
More Decks by mattak
See All by mattak
人間はどこまでさぼれるか? AIコーディングで人の関与を計測してみた
mattak
0
19
最近やった作業環境改善施策10個
mattak
0
330
UnixTime is Simple
mattak
0
290
おっさんが停滞しないために
mattak
32
19k
tech invest
mattak
1
390
Nodux - node base redux framework
mattak
0
1.7k
what_is_technical_investment
mattak
0
220
unitypackage distribution
mattak
0
910
Unity energy usage
mattak
0
1k
Other Decks in Technology
See All in Technology
「Learning Outcome」を書きたくない私が、Learning Outcomeと折り合いをつけるまで
mhlyc
0
160
Practical ransomware detection on macOS (via maths, not AI)
patrickwardle
0
100
Metadata - Section 2: Simple Metadata & Meta Tags
mohab1
0
130
【データ横丁主催】AI エージェント時代のTranslytical Data Platform
shisyu_gaku
0
270
撮るだけでは終わらない。ソニーが挑むB2Bカメラソリューション開発
sony
0
100
Claude Code をローカルとサーバー上で利用した際の Bedrock 利用料をユーザー単位で一本化してみる
ohorig
0
120
プロダクトが成長すると、 プロダクトマネージャーの仕事はどう変わるのか - 「まず作る」から「小さく学び、確かめながら進む」へ
sansantech
PRO
0
120
Let's Change Our World—Again
snoozer05
PRO
6
480
Turning Repos into the Product Second Brain with an LLM Wiki
linedevth
0
150
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
260
フィンテック養成勉強会#68
finengine
0
240
dbt Semantic Layerで進めるenechainのデータ民主化
akizhou
1
240
Featured
See All Featured
Docker and Python
trallard
47
4.2k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
530
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
Visualization
eitanlees
153
17k
Become a Pro
speakerdeck
PRO
31
6.3k
Transcript
͔Ώ͍ͱ͜Ζʹ ख͕ಧ͘ ,PUMJO/JHIU !NBUUBL
,PUMJOͷศརͳॻ͖ํͭհ͢ΔΑ
MB[Z ✨ΪϦΪϦ·Ͱ࣮ߦ͠ͳ͍✨
class Person( val firstName: String, val lastName: String ) {
val fullName by lazy { “${firstName}, ${lastName}” } } // ͜ͷ࣌Ͱ fullNameͭ͘ΒΕͳ͍ val person = Person(“John”, “Due”) // ΞΫηεͯ͠ॳΊͯ࡞͞ΕΔ println(person.fullName)
MFU OJMDPBMFTDJOHPQFSBUPS ✨JGMFUͯ͠ฦΓ͕΄͍͠✨
// ී௨ͷॻ͖ํ var name: String? = “Kana” var message: String
= if (name!=null) “Hello, ${name}!” else “Hello.” // let+null coalescing op var name: String? = “Kana” var message: String = name?.let { “Hello, ${it}!” } ?: “Hello.”
DMBTTKBWB ✨KBWBͷΫϥεΦϒδΣΫτ͕΄͍͠✨
// ී௨ͷॻ͖ํ javaClass<Sample>() // M13Ҏ߱ͷॻ͖ํ Sample::class.java // ͍υίϩɺ(TPOύʔε͢Δͱ͖ͳͲ val gson
= Gson() val person = gson.fromJson(“{\”name\”: \”Ocelot\”}”, Person::class.java)
HFUUFSTFUUFS ✨HFUUFSTFUUFS͕͔ΜͨΜʹ͔͚ΔΑ✨
// Computed properties class Duration(val interval: Long) { var seconds:
Double get() = interval.toDouble() / 1000 set(value) { this.interval = value * 1000 } } // javaͷsetter/getter͕KotlinͩͱpropertyʹͳΔΑ person.name = “John” // person.setName(String name) person.name // person.getName()
0CKFDU ✨4JOHMFUPO͕΄͍͠ʂ✨
// java class Singleton { private static Singleton instance =
null; public static Singleton getInstance() { if (instance == null) { instance = new Singleton(); } return instance; } } // kotlin object Singleton() // Objectlazy. ॳճΞΫηεͰOFX͞ΕΔ Singleton
// java class NotSingleton { public static void callClassMethod() {}
} NotSingleton.callClassMethod(); // kotlin class NotSingleton { companion object { fun callClassMethod() {} } } NotSingleton.callClassMethod()
UIJT! ✨ͲͷUIJT͔໌ࣔͯ͠ΞΫηε͍ͨ͠✨
class A { inner class B { fun doit() {
val a = this@A // instance of class A val b = this@B // instance of class B } } }
6OJU ✨+BWBͷ7PJEʹରԠ͢Δͭ✨
public open class UpdateModel { // ΠϕϯτΛૹ৴͍͚ͨ͠ͲɺແҙຯͳΛૹΓ͍ͨ࣌ͱ͔ val updateEvent by
lazy { BehaviorSubject.create<Unit>() } fun update() { // Unit Object. ৽͍͠instanceΛͭ͘Βͳ͍ updateEvent.onNext(Unit) } }
&YUFOTJPO ✨طଘͷΫϥεʹϝιουΛ͚͍ͨ͠✨
// طଘͷΫϥεΛ֦ுग़དྷΔ fun <T> Observable<T?>.notNulls(): Observable<T> { return this.filter {
it != null }. map { it!! } } // ΑΓγϯϓϧʹʂ val observable = Observable.just<Int?>(1, null, 2, null) val normal = observable.filter { it != null }. map { it !! } val pretty = observable.notNulls()
͍͡ΐ͏Ͱ͢ ✨&OKPZLPUMJO✨