Here is what my class looks like.
public class Data {
private int stateCode;
private int countyCode;
private String stateName;
private String countyName;
private int count1992;
private int count1997;
private int count2002;
private int count2007;
public Data(int stateCode, int countyCode, String stateName, String countyName, int count1992, int count1997, int count2002, int count2007){
this.stateCode = stateCode;
this.countyCode = countyCode;
this.stateName = stateName;
this.countyName = countyName;
this.count1992 = count1992;
this.count1997 = count1997;
this.count2002 = count2002;
this.count2007 = count2007;
}
}
I have an ArrayList of these objects, but the user needs to select which to sort by, both primarily and secondarily. Also, both need to be sorted either ascending or descending.
I'm having trouble with how to sort this Arraylist; I'm not sure whether it will be needed to be sorted by a String or and int. Also, I'm not sure how I can choose two class parameters and sort by them. Hopefully my question makes sense. Thanks.