title: toString method in Java to print a symbol table
body: <p>I'm doing a project where I build a simple symbol table consisting of two arrays : ArrayOfKeys and ArrayOfValues.
  The keys are words and the values are the frequencies of each word in a text.
  I need to write a toString method for my ST class using this model:</p>
  
  <pre><code> public String toString() {
      // write your toString() method here
  }
  </code></pre>
  
  <p>Suppose the words "aaa" and "bbb" are read from the text and inserted in the ST.
  The toString method will be called like this:</p>
  
  <pre><code>StdOut.println("Let's see ST1 with 4 pairs key-val: " + st1);
  </code></pre>
  
  <p>where "st1" is an instance of the ST class.
  The output should be this: </p>
  
  <p><em>Let's see ST1 with 4 pairs key-val: {'aaa': 1 , 'bbb': 1}</em></p>
  
  <p>As I see, the entire symbol table should be printed in the return statement of the toString() method, because it needs to return a String. I don't know how to do this, let alone in the format shown above.</p>
  
  <p>The best I could try was:</p>
  
  <pre><code>return (arrayOfKeys + ":" + arrayOfValues);
  </code></pre>
  
  <p>PS: I'm using Java version 1.8.0_121.</p>