Martin Vietor wrote:public class PatientInfo() implements Comparable
That should be
You want its instances to be comparable to other instances, and that's what the generic part does. It then requires you to have the following method:
Without the generics the parameter type would be Object and you would need to cast it to PatientInfo.
As for the implementation, Christophe has already told you how to do it. Simply delegate the comparison to name comparison. Just one thing to think about: do you want to search case insensitively or not? If so, String has a second comparison method for this.