It uses hashing for storing values.
It does not guarantee the insertion order of elements.
It does not support duplicates.
Example:
import java.util.*;
class demo
{
public static void main(String[] args){
HashSet
al.add("bhabani");
al.add("pinku");
al.add("mahesh");
al.add("arvind");
al.add("arjan");
System.out.println(al);
}};
Output:
[Mahesh,pinku,arvind,bhabani,arjan]
No comments:
Post a Comment