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
SOUZOUxMERCARI-A Story of Cute Birds and Oldman
Search
jsugai
November 24, 2017
670
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
410
Swift <-> Kotlin
jsugai
0
490
Prepare for Android 8.0/GDG-Kobe 2017-09-18
jsugai
0
83
Hashtag
jsugai
1
640
Layout ファイルののメンテナンス
jsugai
1
540
Ho Chi Minh.apk
jsugai
0
53
Umeda.apk 報告会資料
jsugai
1
570
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
55
8.4k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
Code Review Best Practice
trishagee
74
20k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
4 Signs Your Business is Dying
shpigford
187
23k
How STYLIGHT went responsive
nonsquared
100
6.3k
Mobile First: as difficult as doing things right
swwweet
225
10k
Deep Space Network (abreviated)
tonyrice
0
370
How to make the Groovebox
asonas
2
2.5k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
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 ͳͷେࣄ͚ͩͲϦιʔε༗ݶɻ ύϑΥʔϚϯε "ίʔυͷ࣭" Ͱͳ͘ "ΞϓϦͷ࣭" ͳͷͰಉ͡؍Ͱٞ͠ͳ͍ɻ
ଞͷࣄྫɺ·ͨผͷػձʹ! ใަͱ͔͍ͯͩ͘͠͞