HashSet Concept Simplified In Java

July 17, 2013

HashSet: Hashset is introduced in 1.2V in java. The features are..
  • Underlying data structure is HashTable. 
  • Insertion order is not preserved. It is based on hashcode of objects.
  • Null insertion is possible but only once.
  • Heterogeneous objects are allowed.
  • Duplicate objects are not allowed.[ If tried to insert a duplicate object, Java will not throw any Compile time error or run time exception,simply the add method will return false.]
  • HashSet implements serializable and cloneable interface.
  • It does not implement RandomAccess Interface
Hashset is best when we do search operation in application. The process is very fast.

You Might Also Like