title: Can I Get A List Of Keys In An entrySet In Java Without Using Generics?
body: <p>I'm using BeanShell in JMeter. BeanShell is a Java interpreter that does not support generics. As soon as I enter an angle bracket (e.g. "&lt;") my script will be rejected.</p>
  
  <p>If I could use generics I would do the following:</p>
  
  <pre><code>for ( Map.Entry&lt;String,Object&gt; entry : vars.entrySet() ) {
      System.out.println( "  key = " + entry.getKey() );
  }
  </code></pre>
  
  <p>However I cannot create the variable entry because I'm not permitted to declare <code>Map.Entry&lt;String,Object&gt;</code> in my script.</p>
  
  <p>So - given my method <code>entrySet()</code> and the type it returns of <code>Set&lt;Map.Entry&lt;String,Object&gt;&gt;</code> is there any way I can get a list of (or iterate over) the keys in this set without explicitly referring to a generic type?</p>
  
  <p>e.g. something like:</p>
  
  <pre><code>for ( String keys : vars.entrySet().somethingMagic() ) {
      System.out.println( "  key = " + key );
  }
  </code></pre>