hashset add methods code example
Example: HashSet add(E e) method in java
import java.util.HashSet;
public class HashSetAddMethodExample
{
public static void main(String[] args)
{
HashSet<String> hs = new HashSet<String>();
// populating hash set
hs.add("violet");
hs.add("indigo");
hs.add("blue");
hs.add("green");
hs.add("yellow");
System.out.println("HashSet of colors: " + hs);
}
}