Assume I have a user defined Java class called Foo such as:
public class Foo
{
private String aField;
@Override
public String toString()
{
return aField;
}
}
and a Collection such as:
List<Foo> aList;
What I am looking to do is to sort the List alphabetically based upon each member's returned '.toString()' value.
I have tried using the Collections.sort() method, but the result was not what I was attempting. What do I need to do inorder to accomplish this?