fork download
  1. import java.util.*;
  2.  
  3. class Tester
  4. {
  5. public static void main (String[] args)
  6. {
  7. Map map = new HashMap();
  8. map.put("key", "value");
  9. Set set = map.keySet();
  10. Object[] array = set.toArray(); //retrieve the array version of the key set
  11. System.out.println(Arrays.toString(array)); //print it
  12. }
  13. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
[key]