+ 1

What is the difference between Java's HashSet and LinkedHashSet?

28th Jun 2017, 7:12 AM
Haider Ali
Haider Ali - avatar
4 Respuestas
+ 1
When we iterate through a HashSet, the order is unpredictable while it is predictable in case of LinkedHashSet.. because LinkedHashSet maintained the order of insertion because the underlying data structure is doubly-linked list
28th Jun 2017, 7:27 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
thanks for delivering the concept
28th Jun 2017, 7:34 AM
Haider Ali
Haider Ali - avatar
0
So the order of insertion isn't maintained in HashSet unlike LinkedHashSet. Correct?
28th Jun 2017, 7:30 AM
Haider Ali
Haider Ali - avatar
0
ya
28th Jun 2017, 7:32 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar