I have a Map that has strings for both keys and values.
Data is like following:
\"question1\", \"1\" \"question9\", \"1\" \"que
In Java 8 you can also use .stream().sorted():
myMap.keySet().stream().sorted().forEach(key -> { String value = myMap.get(key); System.out.println("key: " + key); System.out.println("value: " + value); } );