title: how to get the values from hash map and put them in array?
body: <p>I am trying to pull the values from hash map and put them in array, but I keep getting a null pointer exception.</p>
  
  <p>Is there any other way to do this?</p>
  
  <pre><code>//some code....
  String n[]=new String[tcur.getCount()];;
  String t[]=new String[tcur.getCount()];;
  HashMap&lt;Integer, String&gt; typehashmap=new HashMap&lt;Integer, String&gt;();
  HashMap&lt;Integer, String&gt; namehashmap=new HashMap&lt;Integer, String&gt;();
  
  //some code..
  String   type[]=typehashmap.keySet().toArray(new String[typehashmap.size()]);
  String   name[]=namehashmap.keySet().toArray(new String[namehashmap.size()]);          
  
  
  for (int i=0;i&lt;=type.length;i++) {
      n[i]=namehashmap.get(nameiterator[i]).toString();
      System.out.println(n[i]);
      t[i]=typehashmap.get(typeiterator[i]).toString();
      System.out.println (t[i]);
  }
  </code></pre>