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
240
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.5k
App hibernation🥶
operando
0
270
できる!Android Framework Code Reading
operando
1
800
設定だけでCircleCIの実行時間を短縮できるかもしれない話
operando
0
270
スタートアップ再びの一年と知の探索
operando
0
660
ピースオブケイクでのZapier活用術
operando
1
1.2k
Other Decks in Technology
See All in Technology
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
6
670
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.9k
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
420
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
Taming you application's environments
salaboy
0
200
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
140
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
Platform Engineering for Software Developers and Architects
syntasso
1
520
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
180
Featured
See All Featured
Designing the Hi-DPI Web
ddemaree
280
34k
Six Lessons from altMBA
skipperchong
27
3.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Speed Design
sergeychernyshev
25
620
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
RailsConf 2023
tenderlove
29
900
How GitHub (no longer) Works
holman
310
140k
Documentation Writing (for coders)
carmenintech
65
4.4k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
KATA
mclloyd
29
14k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
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!