My declaration of the map is as follows:
Map<Integer, String[]> mapVar = new HashMap<Integer, String[]>();
And I initialized it by making several string arrays and putting them into my map with a corresponding Integer.
I would like to then Iterate through all of the elements in my String array within the map. I tried these two possiblities but they're not giving me the right values:
for(int ii =0; ii < 2; ii++)
System.out.println(((HashMap<Integer, String[]>)mapVar).values().toArray()[ii].toString());
and
mapVar.values().toString();
I also know the array and Integer are going into the map fine, I just don't know how to access them.
Thanks
toString()representation of aString[]. You want to print the individual Strings, not the array object'stoString(). See my answer.