I'm getting NotSerializableException and the reason is an anonymous inner class how can I make this customized comparator for a TreeSet implements Serializable interface too .
badPatients = new TreeSet<Patient>(new Comparator <Patient>() {
public int compare(Patient p1,Patient p2) {
if(p1.getStatus() > p2.getStatus())
return -1;
if(p1.getStatus() == p2.getStatus())
return 0;
return 1;
}
});