In this post we will see what are the similarities between Similarities between HashSet, LinkedHashSet, TreeSet. We are assuming, you have read the HashSet, LinkedHashSet and TreeSet.
There are some more post related to these class, that is also important for interview questions.
1. Difference between HashSet and TreeSet
2. HashSet vs LinkedHashSet
Similarities between HashSet, LinkedHashSet, TreeSet
- The HashSet, LinkedHashSet and TreeSet implements the Set interface. It means they don’t allow the duplicate elements.
- The HashSet, LinkedHashSet and TreeSet also implements the Cloneable and serializable interface.
- These three classes are not thread safe. If we want to use them in multithreading environment the we have to make them externally synchronized.