Map<String, Integer> unSortedMap = getUnSortedMapFromSource(); Map<String, Integer> sortedMap = new TreeMap<String, Integer>(unSortedMap);