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
operandoOS
December 09, 2016
Technology
1
250
Kotlinでマッチョ💪💪💪💪💪する話
Kotlinでマッチョ💪💪💪💪💪する話
Retty Tech Cafe #8
https://retty.connpass.com/event/45628/
operandoOS
December 09, 2016
Tweet
Share
More Decks by operandoOS
See All by operandoOS
Flutter ランチ #2
operando
0
150
Flutter ランチ #1
operando
0
110
10XでのZapier活用事例の紹介
operando
0
1.1k
CircleCIでtiming dataに基づいたテスト分割をDartで利用できるようにした話.
operando
3
2.6k
App hibernation🥶
operando
0
290
できる!Android Framework Code Reading
operando
1
820
設定だけでCircleCIの実行時間を短縮できるかもしれない話
operando
0
280
スタートアップ再びの一年と知の探索
operando
0
680
ピースオブケイクでのZapier活用術
operando
1
1.3k
Other Decks in Technology
See All in Technology
実践! ソフトウェアエンジニアリングの価値の計測 ── Effort、Output、Outcome、Impact
nomuson
0
2.1k
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!座学①
siyuanzh09
0
110
Evolving Architecture
rainerhahnekamp
3
260
【NGK2025S】動物園(PINTO_model_zoo)に遊びに行こう
kazuhitotakahashi
0
250
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
160
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
540
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
2.4k
ゼロからわかる!!AWSの構成図を書いてみようワークショップ 問題&解答解説 #デッカイギ #羽田デッカイギおつ
_mossann_t
0
1.5k
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
250
20250116_JAWS_Osaka
takuyay0ne
2
200
iPadOS18でフローティングタブバーを解除してみた
sansantech
PRO
1
150
機械学習を「社会実装」するということ 2025年版 / Social Implementation of Machine Learning 2025 Version
moepy_stats
6
1.5k
Featured
See All Featured
A Tale of Four Properties
chriscoyier
157
23k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Fireside Chat
paigeccino
34
3.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
A designer walks into a library…
pauljervisheath
205
24k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Transcript
KotlinͰ Ϛονϣ ͢Δ Retty Tech Cafe #8
About Me Shinobu Okano @operandoOS Mercari, Inc. Souzoh, Inc.
None
ຖ30 Kotlinͬͯ·͢ • ࡶʹࡶʹϝϞΛͯ͠·͢ • http://hack-it-iron.hatenablog.com/archive/ category/Kotlin
Tuple ෳݸͷΛΈʹͯ͠·ͱΊͨͷ
Α͏ Ұ࣌తͳείʔϓͰෳݸͷσʔλͷΈ߹Θ͕ͤ ཉ͍͚͠ͲɺClassΛఆٛ͢Δ΄ͲͰͳ͍ͳʔ ͬͯ࣌ʹ༗ޮ
Guild https://github.com/operando/Guild/ Simple java tuples.
ͳͥTuple͕ඞཁ͔ͩͬͨ • Android + JSON-RPC • http://www.slideshare.net/shinobuokano7/ android-jsonrpc • ཧ༝ॻ͍ͯ͋Δ͔ʁ
KotlinͷPair val pair = 1 to "pair" println(pair.first) // 1
println(pair.second) // pair
Triple͋ΔΑ val triple = Triple(1, true, "Triple") println(triple.first) // 1
println(triple.second) // true println(triple.third) // Triple
͜ΕΛΈ͓ͯͬͨ
͜͏ॻ͚ͳ͍ͷʁ val triple = 1 to true to "Triple"
͜͏ॻ͚ͳ͍ͷʁ val triple = A to B to C
ͦͷ··Ͱॻ͚ͳʔ͍ • Pair in Pairʹͳͬͯ͠·͏ • Pair<Pair<A,B>,C> • ((1,true)"Triple")
ͳʔΜͩɺΧοίΘΔ͍
ͦͦ Pairͷtoͬͯ Ͳ͏ͳͬͯΔΜͩ?
ͦͦ PairͷtoͬͯͲ͏ͳͬͯΔΜͩ? public infix fun <A, B> <A, B>.to(that: B)
: Pair<A, B> = Pair(this, that)
ͳΔ΄Ͳ
͍ɺ·ͯΑ
ಉ͡Α͏ʹ֦ுؔ ࡞ΕͰ͖Δ͔☺
Pair͔ΒTripleΛ࡞Δ֦ுؔΛॻ͍ͯΈͨ infix fun <A, B, C> Pair<A, B>.to(that: C) :
Triple<A, B, C> = Triple(this.first, this.second, that)
͡ΌtoͰͭͳ͛ͯ ॻ͍ͯΈΑ͏
͡ΌtoͰͭͳ͛ͯॻ͍ͯΈΑ͏ val triple = 1 to true to "Triple" println(triple.first)
// 1 println(triple.second) // true println(triple.third) // Triple println(triple.javaClass) // class kotlin.Triple
Ͱ͖ͨ☺
ͬͱϚοεϧ ͍ͨ͠Ͱ͠ΐʁ
4ͭͷΛ࣋ͭ Tuple QuartetΛ࡞Ζ͏
4ͭͷΛ࣋ͭTuple QuartetΛ࡞Ζ͏ class Quartet<out F, out S, out T, out
FO>( val first: F, val second: S, val third: T, val fourth: FO,) { override fun toString(): String { return "Quartet(first=$first, second=$second, third=$third, fourth=$fourth)" } }
toͭͳ͗ͰQuartetΛ ࡞ΕΔΑ͏ʹ͢Δ
Triple͔ΒQuartetΛ࡞Δ֦ுؔΛॻ͘ infix fun <A, B, C, D> Triple<A, B, C>.to(that:
D): Quartet<A, B, C, D> = Quartet(this.first, this.second, this.third, that)
QuartetͬͯΈΑ͏ val quartet = 1 to 10L to true to
"quartet" println(quartet.first) // 1 println(quartet.second) // 10 println(quartet.third) // true println(quartet.fourth) // quartet
ͬͱϚοεϧ ΄͘͠ͳ͍??
5ͭͷΛ࣋ͭ Tuple QuintetΛ࡞Ζ͏
5ͭͷΛ࣋ͭTuple QuintetΛ࡞Ζ͏ class Quintet<out F, out S, out T, out
FO, out FI>( val first: F, val second: S, val third: T, val fourth: FO, val five: FI) { override fun toString(): String { return "Quintet(first=$first, second=$second, third=$third, fourth=$fourth, five=$five)" } }
͍͍ɺtoΛͭͳ͛ͯ ॻ͍ͯ࡞Γ͍ͨΑͶ
͍͍ɺ֦ு֦ؔுؔ infix fun <A, B, C, D, E> Quartet<A, B,
C, D>.to(that: E): Quintet<A, B, C, D, E> = Quintet(this.first, this.second, this.third, this.fourth, that)
QuintetͬͯΈΑ͏ val quintet = 1 to 10L to true to
LocalDateTime.now() to "quintet" println(quintet.first) // 1 println(quintet.second) // 10 println(quintet.third) // true println(quintet.fourth) // 2016-12-09T19:45:38.959 println(quintet.five) // quintet
Libraryʹ͠·ͨ͠
Guild Kotlin https://github.com/operando/Guild/ tree/master/guild-kotlin ͍͔ͭjCenterͱ͔ʹ͋͛·ʔ͢
Links • Pair͔ΒTripleΛ࡞Δ֦ுؔΛॻ͍ͯΈͨ - 2016/12/03ͷ30 KotlinϝϞ • http://hack-it-iron.hatenablog.com/entry/2016/12/03/165601 • 4ͭͱ5ͭΛ࣋ͭTupleΛ࡞ͬͯΈͨ
- 2016/12/04ͷ30 KotlinϝϞ • http://hack-it-iron.hatenablog.com/entry/2016/12/04/223509 • TupleϥΠϒϥϦ GuildͷKotlin൛࡞ͬͯΈͨ - 2016/12/09ͷ30 KotlinϝϞ • http://hack-it-iron.hatenablog.com/entry/2016/12/09/172657 • Guild • https://github.com/operando/Guild/
Thanks!