Set Concept Simplified In Java

digitization, transformation, binary
Spread the love

Set: Set is again a child interface of collection got introduced in Java-1.2V.

The Set interface extends to the Collection interface and it contains the methods that are inherited from Collection interface. The Set interface does not allow the use of duplicate elements in a collection.Hence the add() method returns false if we add the duplicate element to the collection.

If we want to represent a group of objects as a single entity where duplicates are not allowed and insertion order is not preserved, In such case we must implement Set .

The classes extending Sets are…

  • HashSet(C-1.2V)
  • LinkedHashSet(C-1.4V)

The Interfaces extends sets are…

  • SortedSet(I-1.2V)
  • NavigableSet(I-1.6V)
  • TreeSet(C-1.2V)

Set interface doesn’t contain any new methods and hence we have to use only collection interface methods.

Spread the love
READ  BigDecimal Class in Java
I am the founder and owner of the blog -, always love to share knowledge on test automation,tools,techniques and tips.I am a passionate coder of Java and VBScript.I also publish articles on Travel ideas and great honeymoon destinations.Apart from these, I am a gear-head,love to drive across India. I have shared lots of articles here on How to travel several parts of India.Customization of cars aka car modification is my another hobby.Get in touch with me on


Please enter your comment!
Please enter your name here