I am trying to add the key values from a Treemap to a String[], but i am doing something wrong and i get this: “[Ljava.lang.String;@281ec58a”. Can anyone help?
Thanks in advance.
This is the code i’m using:
TreeMap t = new TreeMap(hm); //hm is a Hashmap
t = (TreeMap) sortByValues(t); // i sort the values with this method
String [] tempa = (String[]) t.keySet().toArray(new String[t.size()]);
"[Ljava.lang.String;@281ec58a"is simply how arrays are printed (i.e. converted to a string) by default. If you iterate over the contents of the array, and print each element in turn, you’ll likely find that everything is as expected.