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
38
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
87
Support for HSM-like capabilities in Android
harri35
0
150
Why doesn't my in-app QR code work (on location)?
harri35
0
38
Git merge-base
harri35
1
81
Smoke testing your library
harri35
0
30
Data classes in Kotlin
harri35
0
40
How to do delegation in Kotlin
harri35
0
40
Two-factor authentication at GDG Riga
harri35
0
78
Two-factor authentication at GDG Tartu
harri35
0
62
Other Decks in Programming
See All in Programming
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
20
6.5k
CSC307 Lecture 17
javiergs
PRO
0
320
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
2
950
技術記事、 専門家としてのプログラマ、 言語化
mizchi
4
1.5k
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
260
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.6k
Inside Stream API
skrb
1
680
ふつうのFeature Flag実践入門
irof
7
3.7k
JavaDoc 再入門
nagise
0
320
Claspは野良GASの夢をみるか
takter00
0
180
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
3Dシーンの圧縮
fadis
1
710
Featured
See All Featured
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
360
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
600
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
400
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
55k
Git: the NoSQL Database
bkeepers
PRO
432
67k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
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?