read text file and store in hashmap. Then sort in order
File is like this: name1 134.2 name2 456.7 name3 265.3 ... ... I read the text file and store in HashMap after that I want to sort in order(by the highest value) but the problem is that because I sort the values in String, I cant compare it. So..is there a way to put the values of textfile into hashmap in double or integer form? import java.io.*; import java.util.*; class Test { public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new FileReader("score.txt")); HashMap<String, String> map = new HashMap<String, String>(); while (scanner.hasNextLine(