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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Harri Kirik
April 02, 2018
Programming
0
36
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
83
Support for HSM-like capabilities in Android
harri35
0
140
Why doesn't my in-app QR code work (on location)?
harri35
0
34
Git merge-base
harri35
1
73
Smoke testing your library
harri35
0
28
Data classes in Kotlin
harri35
0
34
How to do delegation in Kotlin
harri35
0
39
Two-factor authentication at GDG Riga
harri35
0
74
Two-factor authentication at GDG Tartu
harri35
0
57
Other Decks in Programming
See All in Programming
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
560
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
560
Claude Codeログ基盤の構築
giginet
PRO
7
2.9k
SourceGeneratorのマーカー属性問題について
htkym
0
190
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.5k
CSC307 Lecture 13
javiergs
PRO
0
320
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
420
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
130
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
720
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.6k
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
220
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.6k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
Tell your own story through comics
letsgokoyo
1
840
Abbi's Birthday
coloredviolet
2
5.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
110
Un-Boring Meetings
codingconduct
0
220
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
470
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
390
Building the Perfect Custom Keyboard
takai
2
710
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
630
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
970
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?