title: Using the keySet() method in HashMap
body: <p>I have a method that goes through the possible states in a board and stores them in a HashMap</p>
  
  <pre><code>void up(String str){
    int a = str.indexOf("0");
    if(a&gt;2){
     String s = str.substring(0,a-3)+"0"+str.substring(a-2,a)+str.charAt(a-3)+str.substring(a+1);
     add(s,map.get(str)+1);
     if(s.equals("123456780")) {
      System.out.println("The solution is on the level  "+map.get(s)+" of the tree");
  
          //If I get here, I need to know the keys on the map
         // How can I store them and Iterate through them using 
        // map.keySet()?
  
     }
    }
  </code></pre>
  
  <p>}</p>
  
  <p>I'm interested in the group of keys. What should I do to print them all?</p>
  
  <p><code>HashSet t = map.keySet()</code> is being rejected by the compiler as well as</p>
  
  <pre><code>LinkedHashSet t = map.keySet()
  </code></pre>