I know following things about linkedHashSet
- it maintains insertion order
- uses LinkedList to preserve order
- my question is how does hashing come into picture ??
I understand If hashing is used then the concept of bucketing comes in
However, from checking the code in the JDK it seems that LinkedHashSet implementation contains only constructor and no implementation, so I guess all the logic happens in HashSet?
- so hashSet uses LinkedList by default ?
Let me put my question this way ... if objective is to write a collection that
- maintains unique values
- preserves insertion order using a linked list THEN ... it can easily be done without Hashing ... may be we can call this collection LinkedSet
saw a similar question what's the difference between HashSet and LinkedHashSet but not very helpful
Let me know if i need to explain my question more