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
0
33
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
79
Support for HSM-like capabilities in Android
harri35
0
130
Why doesn't my in-app QR code work (on location)?
harri35
0
28
Git merge-base
harri35
1
69
Smoke testing your library
harri35
0
25
Data classes in Kotlin
harri35
0
31
How to do delegation in Kotlin
harri35
0
32
Two-factor authentication at GDG Riga
harri35
0
71
Two-factor authentication at GDG Tartu
harri35
0
53
Other Decks in Programming
See All in Programming
GraphRAGの仕組みまるわかり
tosuri13
7
480
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
420
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
340
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
330
Claude Codeの使い方
ttnyt8701
1
130
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
230
技術同人誌をMCP Serverにしてみた
74th
0
280
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
190
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
470
「ElixirでIoT!!」のこれまでとこれから
takasehideki
0
370
C++20 射影変換
faithandbrave
0
520
地方に住むエンジニアの残酷な現実とキャリア論
ichimichi
5
1.3k
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
A better future with KSS
kneath
239
17k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
VelocityConf: Rendering Performance Case Studies
addyosmani
330
24k
Faster Mobile Websites
deanohume
307
31k
Scaling GitHub
holman
459
140k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Being A Developer After 40
akosma
90
590k
Producing Creativity
orderedlist
PRO
346
40k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
The Cost Of JavaScript in 2023
addyosmani
51
8.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?