title: Counting nodes for each index + toString
body: <p>So I was wondering if there is a way to print out which index of the list has the most collisions? As well as this, I wanted to know, what is the best way to produce a toString() for my LinkedList? I've tried a few times with the default implementation for a LinkedList toString but I can't quite figure out how to do it. </p>
  
  <p>Thanks in advance!</p>
  
  <p>Code:</p>
  
  <pre><code>static LinkedList&lt;Node&gt; hashTable[] = new LinkedList[100];
  
  static class Node {
      int value;
      int key;
  
      @Override
      public String toString() {
          return "Value: " + value + " " + "Key: " + key;
      }
  }
  
  public static void main(String[] args) throws FileNotFoundException {
  
      File f = new File("Ex5.txt");
  
      Scanner scan = new Scanner(f);
  
      if (f.exists() == false) {
          System.out.println("File doesn't exist or could not be found.");
          System.exit(0);
      }
  
      for (int i = 0; i &lt; 100; i++) {
          hashTable[i] = null;
      }
  
      while (scan.hasNextInt()) {
          int n = scan.nextInt();
          insert(n, hashFunction(n));
      }
  
      for (int i = 0; i &lt; 100; i++) {
          System.out.println(hashTable[i]);
      }
  
      int emptyEntries = 0;
  
      for (int i = 0; i &lt; 100; i++) {
          if (hashTable[i] == null) {
              emptyEntries += 1;
          }
      }
      System.out.println("Number of empty entries: " + emptyEntries);
  }
  
  public static void insert(int key, int value) {
      int index = hashFunction(value);
      LinkedList&lt;Node&gt; items = hashTable[index];
  
      if (items == null) {
          items = new LinkedList&lt;&gt;();
  
          Node item = new Node();
          item.key = key;
          item.value = value;
  
          items.add(item);
  
          hashTable[index] = items;
      } else {
          for (Node item : items) {
              if (item.key == key) {
                  item.value = value;
                  return;
              }
          }
  
          Node item = new Node();
          item.key = key;
          item.value = value;
  
          items.add(item);
      }
  }
  
  public static int hashFunction(int value) {
      int hashKey = value % 100;
      return hashKey;
  }
  </code></pre>