Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Collections in Kotlin
Search
Harri Kirik
April 02, 2018
Programming
0
35
Collections in Kotlin
5-minute talk about collections in Kotlin
Harri Kirik
April 02, 2018
Tweet
Share
More Decks by Harri Kirik
See All by Harri Kirik
Secure programming techniques: Mobile Development Security guest lecture
harri35
0
81
Support for HSM-like capabilities in Android
harri35
0
130
Why doesn't my in-app QR code work (on location)?
harri35
0
32
Git merge-base
harri35
1
72
Smoke testing your library
harri35
0
27
Data classes in Kotlin
harri35
0
34
How to do delegation in Kotlin
harri35
0
37
Two-factor authentication at GDG Riga
harri35
0
74
Two-factor authentication at GDG Tartu
harri35
0
56
Other Decks in Programming
See All in Programming
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
1k
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.2k
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
120
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
370
Developing static sites with Ruby
okuramasafumi
0
230
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
220
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
8
20k
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
1
210
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
250
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
380
20 years of Symfony, what's next?
fabpot
2
340
愛される翻訳の秘訣
kishikawakatsumi
1
300
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Documentation Writing (for coders)
carmenintech
76
5.2k
Side Projects
sachag
455
43k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
A designer walks into a library…
pauljervisheath
210
24k
Writing Fast Ruby
sferik
630
62k
Automating Front-end Workflow
addyosmani
1371
200k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Faster Mobile Websites
deanohume
310
31k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.6k
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?