Turn the HashSet implementation of Chapter 16 into a generic class. Use an array list instead of an array to store the buckets.

Complete the following file:

HashSet.java

Use the following file:

HashSetDemo.java

import java.util.Iterator;

/**
   This program demonstrates the hash set class.
*/
public class HashSetDemo
{
   public static void main(String[] args)
   {
      HashSet<String> names = new HashSet<String>(101); 
      // 101 is a prime

      names.add("Sue");
      names.add("Harry");
      names.add("Nina");
      names.add("Susannah");
      names.add("Larry");
      names.add("Eve");
      names.add("Sarah");
      names.add("Adam");
      names.add("Tony");
      names.add("Katherine");
      names.add("Juliet");
      names.add("Romeo");
      names.remove("Romeo");
      names.remove("George");

      Iterator<String> iter = names.iterator();
      while (iter.hasNext())
         System.out.println(iter.next());
   }
}