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
SOUZOUxMERCARI-A Story of Cute Birds and Oldman
Search
jsugai
November 24, 2017
660
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SOUZOUxMERCARI-A Story of Cute Birds and Oldman
jsugai
November 24, 2017
More Decks by jsugai
See All by jsugai
OsakaMixLeap #11 LT "Star Trek" and "Software development" are similar
jsugai
0
400
Swift <-> Kotlin
jsugai
0
480
Prepare for Android 8.0/GDG-Kobe 2017-09-18
jsugai
0
80
Hashtag
jsugai
1
620
Layout ファイルののメンテナンス
jsugai
1
530
Ho Chi Minh.apk
jsugai
0
52
Umeda.apk 報告会資料
jsugai
1
560
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
340
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Become a Pro
speakerdeck
PRO
31
6k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
960
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
150
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
200
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
210
Navigating Team Friction
lara
192
16k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
55k
Transcript
͔Θ͍͍খௗΛғ͏ ͓ͬ͞Μୡͷ Mercari, Inc
About me Jun Sugai @calciolife Mercari
Agenda • Welcome Kotlin • Kotlinizing • using Kotlin
Welcome
None
Ͳ͏͍͏ܦҢͰ? Welcome Kotlin/Kotlin ಋೖ
ָͦ͠͏ͳงғؾ͋ͬͨ Welcome Kotlin/Kotlin ಋೖ
•ָͦ͠͏ͳΒͬͯ͠·͏ •໘നͦ͏ͳͬͯ͠·͏ •͕ͳ͚Εڋ൱͠ͳ͍ Welcome Kotlin/Kotlin ಋೖ
Kotlinizing
•ςετίʔυ •Өڹͷগͳ͍ͱ͜Ζ͔Β •৽نͷػೳ͔Β •etc... ABC
•ςετίʔυ •Өڹͷগͳ͍ͱ͜Ζ͔Β •৽نͷػೳ͔Β •etc... ABC શ෦Ͱ͢ΑͶ
ಋೖͬͯײΛॻ͘·ͰΔ ݁ՌΛग़ͯͦ͜͠Ռ ΠλϦΞදͩͬͯϘίϘί
using Kotlin
είʔϓؔ Kotlin ͕Α΄Ͳಛघͳ࣮/࠷దԽͰ ͳ͍ݶΓείʔϓؔཁ͢Δʹ ϝιουΛ࡞ͬͯॲཧΛҠ͔͑͠Δ ίʔυʹࠩ͠ସ͑Δ
None
είʔϓؔ ͏͖ɻReadable ͬͯେࣄɻ
var/val/collection ΞΫηε੍ޚΧϓηϧԽͳͲ Java ΑΓ͔Γ͍͢໘ɺ ଟ༻͢͠͞Ͳ͏ͳΜͩΖ͏?
var/val/collection public class SearchListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private val List<SearchKeyWord>
dataSet = new ArrayList<>(); public SearchListAdapter(SearchListener listener) { this.listener = listener; } //... @Override public int getItemCount() { return dataSet.size(); } public void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet = dataSet; notifyDataSetChanged(); }
var/val/collection public class SearchListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private val List<SearchKeyWord>
dataSet = new ArrayList<SearchKeyWord>() //େࣄͳͱ͜Ζ͚ͩ public void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet.clear() this.dataSet.addAll(dataSet) notifyDataSetChanged(); } // Kotlin ͩͱ immutable ʹͨ͘͠ͳͬͪΌ͏
None
var/val/collection private val List<SearchKeyWord> dataSet = new ArrayList<SearchKeyWord>() //େࣄͳͱ͜Ζ͚ͩ public
void setDataSet(List<SearchKeyWord> dataSet) { this.dataSet.clear() this.dataSet.addAll(dataSet) notifyDataSetChanged(); } •clear() -> addAll() ͷྲྀΕ GC ίετతʹͲ͏ͳͷ? •addAll() ͰՃ͢Δࡍͷཁૉ͕ڊେͳ instance ڊେͳ heap ͷࢀরΛอ࣋͢Δߏͩͱ clear() -> adAll() ͚ͩͰ GC ͕ΔՄೳੑ? •ཁૉͷίϐʔΛ࡞Δ heap ίετ/ϑοτϓϦϯτॲཧશମͰແࢹͰ͖Δ΄Ͳখ͍͞?
var/val έʔεʹԠͯ͡ Readable ͳͷେࣄ͚ͩͲϦιʔε༗ݶɻ ύϑΥʔϚϯε "ίʔυͷ࣭" Ͱͳ͘ "ΞϓϦͷ࣭" ͳͷͰಉ͡؍Ͱٞ͠ͳ͍ɻ
ଞͷࣄྫɺ·ͨผͷػձʹ! ใަͱ͔͍ͯͩ͘͠͞