HashMap
|
TreeMap
|
LinkedHashMap
|
HashTable
|
|
Efficiency
Get,
Put, Remove, containsKey
|
O(1)
|
O(log
n)
|
O(1)
|
O(1)
|
Iteration
Order
|
Random
|
Natural
sort according to key.
|
According
to insertion.
|
Random
|
Interface
|
Map
|
Map
SortedMap
NavigableMap
|
Map
|
Map
|
Synchronized
|
No, but
can make using Collections.synchronizedMap(obj)
|
Yes,
Very slow, so ConcurrentHashMap
|
||
Implemetation
|
Buckets
|
RB Tree
|
HashTable
and LinkedList using doubly LinkedList of buckets.
|
Buckets
|
Best
for random data manipulation.
|
Slow,
but preferred for sorted data.
|
Preserve
the order of insertion.
|
Obslete,
use ConcurrentHashMap
|
|
Null
key/value
|
allowed
|
Not-allowed,
NullPointerException
|
Tuesday 25 August 2015
Conclude HashMap, TreeMap, LinkedHashMap and HashTable
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment