what is HashSet?

Hashset comes under collection framework its used for storing group of data it uses hashtable for storing data.Its comes under set interface which is child interface of collection framework.

HashSet j = new HashSet();

Important Points

1.It doesnt allow duplicate value if duplicate value inserted mean it will return false saying the value already inserted.

2.It allow null value.

3.It doesnt preserve insertion order since it use hascode for storing data.

4.Sometime its heterogeneous.

5.Hashset is best choice for searching since it use hascode().