I have a Map in java that has strings for both .
Data is like following <"question1", "1">, <"question9", "1">, <"question2", "4">, <"question5", "2">
I want to sort the map based on its Key's. So In the end I will have question1, question2, question3....an so on.
Eventually I am trying to get two strings out of this Map. First String: Questions ( in order 1 ..10) and Second String: Answers (in same order as question).
Right now I have the following:
Iterator it = paramMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
questionAnswers += pairs.getKey()+",";
}
This gets me the questions in a string but they are not in order...