Prev Next

Java / Set and its implementations

Difference between HashSet and LinkedHashSet in Java collection.

A LinkedHashSet is ordered as it maintains a doubly-linked List across all elements. When you iterate through a HashSet the order is unpredictable, while a LinkedHashSet lets you iterate through the elements in the order in which they were inserted.

More Related questions...

Show more question and Answers...


Comments & Discussions