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 JDK (beta)
Search
Kengo TODA
August 20, 2012
Technology
2
110
collections in JDK (beta)
To explain the basic collection in JDK
Kengo TODA
August 20, 2012
Tweet
Share
More Decks by Kengo TODA
See All by Kengo TODA
KotlinユーザのためのJSpecify入門 / JSpecify 101 for Kotlin Devs
eller86
0
630
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1.2k
ヒューマンスキル / The Humanskills
eller86
0
580
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
320
Server-side Kotlinを使うスタートアップでどんなDetektルールが育ったか / Detekt rules made in start-up working with Server-side Kotlin
eller86
0
1.4k
Java開発者向けのKotlin Gradleビルドスクリプト入門 / Gradle Build Script in Kotlin 101
eller86
1
1.6k
Goodbye JSR305, Hello JSpecify!
eller86
2
4.9k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.3k
Javaプログラミングの体験向上に関する活動 / DX enhancement around Java programming
eller86
0
3.8k
Other Decks in Technology
See All in Technology
The key to VCP-VCF
mirie_sd
0
160
Unsafe.BitCast のすゝめ。
nenonaninu
0
160
Unlearn Product Development - Unleashed Edition
lemiorhan
PRO
2
170
能動的ドメイン名ライフサイクル管理のすゝめ / Practice on Active Domain Name Lifecycle Management
nttcom
0
310
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
1.8k
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
830
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
26
7.1k
C++26 エラー性動作
faithandbrave
2
880
NOT VALIDな検査制約 / check constraint that is not valid
yahonda
1
110
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
28
25k
UI State設計とテスト方針
rmakiyama
4
940
10年もののバグを退治した話
n_seki
0
140
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
A designer walks into a library…
pauljervisheath
205
24k
A Philosophy of Restraint
colly
203
16k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
It's Worth the Effort
3n
183
28k
Gamification - CAS2011
davidbonilla
80
5.1k
How to train your dragon (web standard)
notwaldorf
88
5.8k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
We Have a Design System, Now What?
morganepeng
51
7.3k
Transcript
collections in JDK - basic data structures you should know
- 2012/Aug/29 Kengo TODA
Basic collection List<T> Set<T> Map<K, T>
ArrayList<T> It just wraps an array Good to #get(int): O(1)
Bad to #remove(int), #contains(T) : O(n)
LinkedList<T> Simple bidirectional list It costs more Java heap than
ArrayList Good to #remove(0), #add(0, T): O(1) Bad to #get(int), #contains(T) : O(n)
How to choose? ArrayList: Stack When we needs random access
LinkedList: Queue (Deque) When we call #remove(int) frequently
HashMap<K, V> It use hash table to manage key We
have to implement #hashCode() correctly It does not implement SortedMap interface
TreeMap<K, V> It use red-black tree to manage key We
have to implement Comparable or Comparator correctly It implements SortedMap
LinkedHashMap<K, V> A subclass of HashMap It has bidirectional list
to memory insertion- order (or access-order) It does not implement SortedMap interface
How to choose? HashMap Standard use TreeMap When we have
to use ordering LinkedHashMap When we have to memory insertion-order
Set ≒ Map HashSet TreeSet LinkedHashSet
Legacy implementations Vector Stack Hashtable Properties @Deprecated
Additional collection Google guava contains useful collections Table<C, R, V>
Multiset<T> Multimap<K, V>