Please enable JavaScript.
Coggle requires JavaScript to display documents.
List - Map - Set, LinkedList - ArrayList, HashMap - HashTable, HashSet -…
List - Map - Set
Set
No duplicate element
Not maintain insertion order
1 null value element
HashSet, TreeSet
List
Allow duplicate element
Maintain insertion order
Multiple null value elements
ArrayList, LinkedList
Map
No duplicate element
Not maintain insertion order
1 null key, multiple null values
HashMap, HashTable
LinkedList - ArrayList
LinkedList
Get element slower
Add/remove element faster
Use more memory
Best for update/delete
ArrayList
Get element faster
Add/remove element slower
Use less memory
Best for add and get
HashMap - HashTable
HashMap
1 key null/multiple value null
faster
not thread-safe unless using proper synchronization code
HashTable
No key/value null
slower
thread safe because it is synchronized
HashSet - TreeSet
HashSet
not maintain insertion order
faster
1 null element
TreeSet
no null element
slower because it has to sort after insert/remove
maintain insertion order