What can I replace the < and > with because i want to compare string below one is compare int, so got any solution to solve this question and doesnt change the function.
public int compareTo(Object o) {
    Patient p = (Patient) o;
    if (this.getCategory() < p.getCategory())
        return -1;
    if (this.getCategory() > p.getCategory())
        return 1;
    else { 
        if (this.getTimeArrived().before(p.getTimeArrived()))
            return -1;
        if (this.getTimeArrived().after(p.getTimeArrived()))
            return 1;
    }
    return 0;
}
How about this? can change the > & < to another solution because i want to compare with string
    import java.util.Comparator;
public class PatientComparator implements Comparator<Patient>{
    public int compare(Patient p1, Patient p2) {
    if (p1.getCategory() < p2.getCategory())
        return -1;
    if (p1.getCategory() > p2.getCategory())
        return 1;
    else { if (p1.getTimeArrived().before(p2.getTimeArrived()))
        return -1;
           if (p1.getTimeArrived().after(p2.getTimeArrived()))
        return 1;
    }
    return 0;
}
}
 
    