LinkedHashSet

 LinkedHashSet:

  • LinkedHashSet is the implementation class of the Set interface which is also used to store groups of individual objects but duplicate values are not allowed.
  • LinkedHashSet internally follows hashtable+doubly Linked List structures.
  • LinkedHashSet is not a synchronized class.
  • LinkedHashSet supports only one null value.

  • LinkedHashSet is called an ordered Collection because it is guaranteed for insertion order of elements.

Creation of LinkedHashSet:

LinkedHashSet<E> hs= new LinkedHashSet<E>();
LinkedHashSet<E> hs= new LinkedHashSet<>(int capacity);
LinkedHashSet<E> hs = new LinkedHashSet<E>(int capacity, float loadfactor);
LinkedHashSet<E> hs= new LinkedHashSet<E>(Collection obj);

Example:

LinkedHashSetExample

Output:

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.