I'm trying to sort a list of strings. The strings contain usernames and their kills. I want to sort the list using the number of kills before username and the -. I have read about Comparator and tried some without any luck.
public class Test {
public static List<String> TOP10_Players = new ArrayList<>();
public static void AddPlayers() {
// TOP10_Players.add("[Kills]-[Username]");
TOP10_Players.add("1-Username1");
TOP10_Players.add("2-Username2");
TOP10_Players.add("3-Username3");
SortList();
}
public static void SortList() {
// Code to sort list
}
}