I have a gigantic data set which I've to store into a collection and need to find whethere any duplicates in there or not.
The data size could be more than 1 million. I know I can store more element in ArrayList
comapre to a Map
.
My questions are:
- is searching key in a
Map
faster than searching in sortedArrayList
? - is searching Key in
HashMap
is faster thanTreeMap
? - Only in terms of space required to store
n
elements, which would be more efficient between aTreeMap
and aHashMap
implementation?