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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Kengo TODA
August 26, 2012
Technology
2
190
collections in JDK
Kengo TODA
August 26, 2012
Tweet
Share
More Decks by Kengo TODA
See All by Kengo TODA
生成AI 業務応用向けガイドライン 斜め読み / Overview of Generative AI Business Application Guidelines
eller86
0
160
KotlinユーザのためのJSpecify入門 / JSpecify 101 for Kotlin Devs
eller86
0
1.9k
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1.7k
ヒューマンスキル / The Humanskills
eller86
0
730
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
490
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
2k
Goodbye JSR305, Hello JSpecify!
eller86
2
5.4k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.6k
Other Decks in Technology
See All in Technology
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
160
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
560
AI駆動開発を事業のコアに置く
tasukuonizawa
1
180
Bedrock PolicyでAmazon Bedrock Guardrails利用を強制してみた
yuu551
0
220
30万人の同時アクセスに耐えたい!新サービスの盤石なリリースを支える負荷試験 / SRE Kaigi 2026
genda
4
1.3k
配列に見る bash と zsh の違い
kazzpapa3
1
140
Webhook best practices for rock solid and resilient deployments
glaforge
1
290
10Xにおける品質保証活動の全体像と改善 #no_more_wait_for_test
nihonbuson
PRO
2
240
Red Hat OpenStack Services on OpenShift
tamemiya
0
100
予期せぬコストの急増を障害のように扱う――「コスト版ポストモーテム」の導入とその後の改善
muziyoshiz
1
1.8k
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
130
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
150
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
310
Site-Speed That Sticks
csswizardry
13
1.1k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
120
Code Review Best Practice
trishagee
74
20k
Tell your own story through comics
letsgokoyo
1
810
30 Presentation Tips
portentint
PRO
1
210
The Language of Interfaces
destraynor
162
26k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
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)