What is a Set in Java?

A Set in Java is an interface which forms an important pillar of the Collections framework. It extends the Collection interface and hence has all the basic methods of a Collection.
The unique thing about Set is it stores only unique values, no duplicates. Also it does not have indexes and hence it does not preserve the insertion order (except LinkedHashSet). There are various implementations of Set but the important ones which Java provides by default are HashSet, TreeSet, LinkedHashSet, EntrySet.

CORE JAVA COLLECTIONS