Similarities between HashSet, LinkedHashSet, TreeSet

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

  1. The HashSet, LinkedHashSet and TreeSet implements the Set interface. It means they don’t allow the duplicate elements.
  2. The HashSet, LinkedHashSet and TreeSet also implements the Cloneable and serializable interface.
  3. These three classes are not thread safe. If we want to use them in multithreading environment the we have to make them externally synchronized.
Similarities between HashSet, LinkedHashSet, TreeSet

Leave a Comment

Follow us on Instagram & watch the latest videos on YouTube. Click below social icons to visit our Instagram & YouTube profiles.