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
100
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
JavaとGroovyで書かれたGradleプラグインをKotlinで書き直した話 / Converted a Gradle plugin from Groovy&Java to Kotlin
eller86
0
1k
ヒューマンスキル / The Humanskills
eller86
0
520
医療機関向けシステムの信頼性 / Reliability of systems for medical institutions
eller86
0
290
Server-side Kotlinを使うスタートアップでどんなDetektルールが育ったか / Detekt rules made in start-up working with Server-side Kotlin
eller86
0
1.3k
Java開発者向けのKotlin Gradleビルドスクリプト入門 / Gradle Build Script in Kotlin 101
eller86
1
1.4k
Goodbye JSR305, Hello JSpecify!
eller86
2
4.7k
Java8〜16におけるバイトコード生成の変化 / Changes of Bytecode Generation from Java 8 to 16
eller86
4
4.2k
Javaプログラミングの体験向上に関する活動 / DX enhancement around Java programming
eller86
0
3.7k
静的解析ツールで生産性向上
eller86
1
880
Other Decks in Technology
See All in Technology
山手線一周のパフォーマンス改善
suzukahr
0
160
ADRを運用して3年経った僕らの現在地
onk
PRO
11
5k
「ばん・さく・つき・たー!」にならないためにSHIROBAKOから 学んだこと
ysknsid25
3
660
Oracle Database 23ai 新機能#4 Real Application Clusters
oracle4engineer
PRO
0
150
軽いノリで"自動化"に取り組んではいけないという話
tetsuyaooooo
1
480
【shownet.conf_】持続可能な次世代Wi-Fi運用に向けて
shownet
PRO
0
350
ドキュメントとの付き合い方を考える
leveragestech
1
130
C# 13 / .NET 9 の新機能 (RC 1 時点)
nenonaninu
1
1.3k
AWSへのNIST SP800-171管理策 導入に向けての整備/20240930 Mitsutoshi Matsuo
shift_evolve
0
200
【shownet.conf_】多様化するネットワーク環境を柔軟に統合するルーティングテクノロジー
shownet
PRO
0
380
Oracle Database 23ai 新機能#4 Application Continuity
oracle4engineer
PRO
0
120
エムスリーマネジメントチーム紹介資料 / Introduction of M3 Management Team
m3_engineering
0
280
Featured
See All Featured
Clear Off the Table
cherdarchuk
91
320k
RailsConf 2023
tenderlove
28
840
Building Adaptive Systems
keathley
38
2.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
45
2k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
The Brand Is Dead. Long Live the Brand.
mthomps
53
38k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
327
21k
Code Review Best Practice
trishagee
62
16k
How to train your dragon (web standard)
notwaldorf
87
5.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
29
1.7k
Bash Introduction
62gerente
608
210k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
25
660
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>