Set Interface

Prev Tutorial Next Tutorial

Set Interface in Java

Set is an Interface in java API which extends Collection Interface. It is used to store multiple objects with unique that means it do not allows to store duplicate elements. Set Interface are implemented in following collection classes.

  • HashSet
  • TreeSet
  • LinkedHashSet

Note: Set is based on Set in general mathematics which also do not store duplicate elements so here Set Interface do not allows to store duplicate elements.

Create object for Set Implementer classes


Set_Implemented_class<generic_class> obj=new Set_Implemented_class<generic_class>();

Example to create object of HashSet

HashSet<String> obj=new HashSet<String>();

Prev Tutorial Next Tutorial

Download Projects

Google Adsense Advertisements
Free Classified Site – Bedpage

Yahoo Advertisements