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
Collections in Kotlin
Search
Harri Kirik
April 02, 2018
Programming
42
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Collections in Kotlin
5-minute talk about collections in Kotlin
Harri Kirik
April 02, 2018
More Decks by Harri Kirik
See All by Harri Kirik
Secure programming techniques: Mobile Development Security guest lecture
harri35
0
92
Support for HSM-like capabilities in Android
harri35
0
160
Why doesn't my in-app QR code work (on location)?
harri35
0
48
Git merge-base
harri35
1
87
Smoke testing your library
harri35
0
32
Data classes in Kotlin
harri35
0
43
How to do delegation in Kotlin
harri35
0
42
Two-factor authentication at GDG Riga
harri35
0
84
Two-factor authentication at GDG Tartu
harri35
0
64
Other Decks in Programming
See All in Programming
アクセシビリティから考える情報設計
high_g_engineer
0
230
信頼性の目標を誰も求めてない
shubox
0
490
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
160
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
120
typoなんかねぇよ
raspython3
0
670
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
210
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
3
280
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
340
이 함수, 실패하면 어떻게 되나요? null부터 Rich Errors까지, Kotlin 에러 처리 15년
haeti2
0
140
Hono + Inertia + React で LP を構築した話
oukayuka
2
210
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4.4k
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
190
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Crafting Experiences
bethany
1
290
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
260
Designing Experiences People Love
moore
143
24k
A Soul's Torment
seathinner
7
3.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Visualization
eitanlees
152
17k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Transcript
designing & developing for mobile Demoday, 05/03/2018 Harri Kirik, engineer
Kotlin: Collections
Kotlin KOTLIN: COLLECTIONS #kotlin
Mutable and immutable KOTLIN: COLLECTIONS #collections
Autogenerated: 1. equals()/hashCode() pair 2. toString() 3. componentN() functions 4.
copy() function KOTLIN: COLLECTIONS #collections
KOTLIN: COLLECTIONS val numbers: MutableList<Int> = mutableListOf(1, 2, 3) val
readOnlyView: List<Int> = numbers println(numbers) // prints "[1, 2, 3]" numbers.add(4) println(readOnlyView) // prints "[1, 2, 3, 4]" readOnlyView.clear() // -> does not compile val strings = hashSetOf("a", "b", "c", "c") assert(strings.size == 3) #demoday
No dedicated syntax KOTLIN: COLLECTIONS #collections
listOf(), mutableListOf(), setOf(), mutableSetOf() KOTLIN: COLLECTIONS #collections
KOTLIN: COLLECTIONS val mutable = mutableListOf(1, 2, 3) val snapshot
= mutable.toList() mutable.add(4) println(mutable) // prints "[1, 2, 3, 4]" println(snapshot) // prints "[1, 2, 3]" #demoday
KOTLIN: COLLECTIONS val mutable = mutableListOf(1, 2, 3) val snapshot
= mutable.toList() snapshot.add(4) // Will not compile! val snapshot2 = snapshot.plus(4) // Returns a new list println(snapshot2 ) // prints "[1, 2, 3, 4]" #demoday
http:// lab.mobi designing & developing for mobile thanks Questions?