Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
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
140
KotlinユーザのためのJSpecify入門 / JSpecify 101 for Kotlin Devs
eller86
0
1.8k
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1.7k
ヒューマンスキル / The Humanskills
eller86
0
710
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
460
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.3k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.5k
Other Decks in Technology
See All in Technology
RAG/Agent開発のアップデートまとめ
taka0709
0
190
今年のデータ・ML系アップデートと気になるアプデのご紹介
nayuts
1
490
年間40件以上の登壇を続けて見えた「本当の発信力」/ 20251213 Masaki Okuda
shift_evolve
PRO
1
140
子育てで想像してなかった「見えないダメージ」 / Unforeseen "hidden burdens" of raising children.
pauli
2
270
Microsoft Agent 365 についてゆっくりじっくり理解する!
skmkzyk
0
380
寫了幾年 Code,然後呢?軟體工程師必須重新認識的 DevOps
cheng_wei_chen
1
1.5k
re:Invent2025 コンテナ系アップデート振り返り(+CloudWatchログのアップデート紹介)
masukawa
0
390
AWS re:Invent 2025~初参加の成果と学び~
kubomasataka
0
110
re:Invent2025 3つの Frontier Agents を紹介 / introducing-3-frontier-agents
tomoki10
0
240
AWS Security Agentの紹介/introducing-aws-security-agent
tomoki10
0
310
Database イノベーショントークを振り返る/reinvent-2025-database-innovation-talk-recap
emiki
0
230
エンジニアとPMのドメイン知識の溝をなくす、 AIネイティブな開発プロセス
applism118
4
1.3k
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
9.4k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Embracing the Ebb and Flow
colly
88
4.9k
Bash Introduction
62gerente
615
210k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
YesSQL, Process and Tooling at Scale
rocio
174
15k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
GraphQLとの向き合い方2022年版
quramy
50
14k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Visualization
eitanlees
150
16k
[SF Ruby Conf 2025] Rails X
palkan
0
540
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>