I am currently reading 2 million lines from a textfile as asked in the previous question Java Fastest way to read through text file with 2 million lines
Now I store these information into HashMap and I want to sort it via TreeMap because I want to use ceilingkey. Is the following method correct?
private HashMap<Integer, String> hMap = new HashMap();
private TreeMap<Integer, String> tMap = new TreeMap<Integer, String>(hMap);
Collections.sort(hMap)? ,Collections.sort(hMap,WITH_MY_OWN_COMPARATOR)?TreeMap? Why the extra step?Collections.sort(hMap)won't work,sort()work with List only