collections | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

collections

Which among the four collections makes fastest operations? A)arraylist B)hash set C)tree set D)linked list

4th Dec 2017, 11:37 PM
Kavya Sri
Kavya Sri - avatar
5 Answers
0
I believe it is depends on the type of the operation. If you need just read ArrayList is better, if you need insert/remove use LinkedList.
5th Dec 2017, 12:25 AM
Dima Makieiev
Dima Makieiev - avatar
0
In my interview , interviewer said hashset
5th Dec 2017, 3:21 AM
Kavya Sri
Kavya Sri - avatar
0
Again if you check manuals and different articles there no such thing like fastest collection. It depends on type of operation you need to perform, this why there are few types of collection. Did you ask him for explanation why?
5th Dec 2017, 3:27 AM
Dima Makieiev
Dima Makieiev - avatar
0
I said arraylist.. but he said no hash set.. and I thought ok.. I did not prolong more.
5th Dec 2017, 3:31 AM
Kavya Sri
Kavya Sri - avatar
0
It is sounds strange for me, like asking what is better int or long...
5th Dec 2017, 3:34 AM
Dima Makieiev
Dima Makieiev - avatar