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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Kengo TODA
August 20, 2012
Technology
2
120
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
生成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
2.1k
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
SRE Enabling戦記 - 急成長する組織にSREを浸透させる戦いの歴史
markie1009
0
110
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
190
広告の効果検証を題材にした因果推論の精度検証について
zozotech
PRO
0
180
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3.9k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
240
超初心者からでも大丈夫!オープンソース半導体の楽しみ方〜今こそ!オレオレチップをつくろう〜
keropiyo
0
110
20260208_第66回 コンピュータビジョン勉強会
keiichiito1978
0
140
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
0
1.1k
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
230
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
130
What happened to RubyGems and what can we learn?
mikemcquaid
0
300
Featured
See All Featured
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
270
Everyday Curiosity
cassininazir
0
130
Automating Front-end Workflow
addyosmani
1371
200k
Testing 201, or: Great Expectations
jmmastey
46
8k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
50k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
A designer walks into a library…
pauljervisheath
210
24k
Darren the Foodie - Storyboard
khoart
PRO
2
2.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Prompt Engineering for Job Search
mfonobong
0
160
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>