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
Search
Kengo TODA
August 26, 2012
Technology
200
2
Share
collections in JDK
Kengo TODA
August 26, 2012
More Decks by Kengo TODA
See All by Kengo TODA
生成AI 業務応用向けガイドライン 斜め読み / Overview of Generative AI Business Application Guidelines
eller86
0
180
KotlinユーザのためのJSpecify入門 / JSpecify 101 for Kotlin Devs
eller86
0
2k
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1.8k
ヒューマンスキル / The Humanskills
eller86
0
750
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
520
Server-side Kotlinを使うスタートアップでどんなDetektルールが育ったか / Detekt rules made in start-up working with Server-side Kotlin
eller86
0
1.6k
Java開発者向けのKotlin Gradleビルドスクリプト入門 / Gradle Build Script in Kotlin 101
eller86
1
2.1k
Goodbye JSR305, Hello JSpecify!
eller86
2
5.5k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.7k
Other Decks in Technology
See All in Technology
はじめてのAI-DLC
yoshidashingo
2
540
Splunk MCPサーバの利活用事例 ーKINTOテクノロジーズの取り組み
kintotechdev
1
320
Anthropic AIネイティブ・スタートアップ構築のプレイブック を理解する
nagatsu
0
180
『家族アルバム みてね』における インシデント対応との向き合い方 / Approach incident response in Family Album
kohbis
2
190
AIAgentと取り組むKaggle
508shuto
2
560
その英語学習、AWSで代替できませんか?
suzutatsu
1
250
TypeScriptとAngular Signal で実現する保守性の高いアプリケーション設計 - 3層アーキテクチャによる責務分離の実践(たつかわ) https://2026.tskaigi.org/talks/10
nealle
1
350
RubyでRuby拡張を書いたらRubyより35倍速になったってどういうこと??
kazuho
3
610
【禁断】Obsidianの第二の脳に「知の巨人」と呼ばれた師匠の脳をロードしてみた
nagatsu
0
6.5k
最新技術を"今は選ばない"という技術選定
leveragestech
PRO
0
420
ソフトウェアサプライチェーン攻撃対策として今からサクッとできること
flatt_security
2
140
The Making of AI Chips
pfn
PRO
0
770
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
360
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
310
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
190
Documentation Writing (for coders)
carmenintech
77
5.3k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
140
How to Think Like a Performance Engineer
csswizardry
28
2.6k
Music & Morning Musume
bryan
47
7.2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
140
Mobile First: as difficult as doing things right
swwweet
225
10k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
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 & #add for head/tail: O(1) Bad to #get(int), #contains(T) : O(n)
How to choose? ArrayList: Stack When we needs random access
LinkedList: Stack, Queue (java.util.Deque) When we treat head or tail 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 → HashMap TreeSet → TreeMap LinkedHashSet
→ LinkedHashMap
Legacy implementations Vector Stack Hashtable Properties @Deprecated
Additional collection Google guava contains useful collections Table<C, R, V>
Multiset<T> Multimap<K, V>
References Source code (OpenJDK, Google guava)