Add a debug method to the HashSet implementation in Section 16.4 that prints the nonempty buckets of the hash table. Run the test program at the end of Section 16.4. Call the debug method after all additions and removals and verify that Figure 16.6 accurately represents the state of the hash table.

Complete the following file:

Use the following file:

HashSetDemo.java

import java.util.Iterator;
import java.util.Set;

/**
   This program demonstrates the hash set class.
*/
public class HashSetDemo
{
   public static void main(String[] args)
   {
      HashSet names = new HashSet(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");

      names.debug();
   }
}