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

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain,, @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: WhatsApp no. 8882538826

Yahoo Advertisements