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
37
0
Share
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
85
Support for HSM-like capabilities in Android
harri35
0
150
Why doesn't my in-app QR code work (on location)?
harri35
0
36
Git merge-base
harri35
1
78
Smoke testing your library
harri35
0
29
Data classes in Kotlin
harri35
0
37
How to do delegation in Kotlin
harri35
0
40
Two-factor authentication at GDG Riga
harri35
0
75
Two-factor authentication at GDG Tartu
harri35
0
57
Other Decks in Programming
See All in Programming
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
720
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
200
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
3
950
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
360
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
470
AI時代になぜ書くのか
mutsumix
0
410
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1.1k
20260514_its_the_context_window_stupid.pdf
heita
0
1k
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
110
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
280
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
3.2k
t *testing.T は どこからやってくるの?
otakakot
1
940
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
Building Applications with DynamoDB
mza
96
7k
Music & Morning Musume
bryan
47
7.2k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Marketing to machines
jonoalderson
1
5.3k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
520
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
230
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
320
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
Abbi's Birthday
coloredviolet
2
7.6k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
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?