Answers for "hashing used to add elements in hashset"

1

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);
   }
}
Posted by: Guest on October-28-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language