I am trying to figure out how to use Comparator / Comparable to sort a Hash Map <Integer, Object> by value within the object. I have been searching for examples but haven't quite found what I am looking for. I'll post a generic situation below.

Program asks user if they would like to sort by id number, Name or School.

public class someClass{

//code to enter data from file into ArrayList of Person objects

//code to assign ArrayList to Hash Map of Person objects using int idNumber as key. <int idNumber, Person object>

}

public class Person{

int idNumber;
String Name;
String School;

//constructor to initialize variables

//getIdNumber(), getName, getSchool methods defined

}

public class SortByName implements Comparator<Person>{

public int compare(Person t, Person t1) {
//some code to compare
}
}

I am unsure about how to implement this, especially if the user is given multiple choices in how they would like to sort the map. If somebody can offer an example or some direction I would greatly appreciate it. This is the only part of my program that has given me problems.