Hello. I have a task to play with Java Collections framework. I need to obtain a users list from a database, and store it in a collection. (This is finished and users are stored in a HashSet). Each user is an instance of Person class described with name, surname, birth date, join date, and some other parameters which are not important now. Next I need to store the list in different collections (there's nowhere stated how many) providing functionality to sort them by:
- name only
- name, surname, birthdate
- join date  
Ok, so to start with, my Person stores data as Strings only (should I change dates to Date ?). I've started implementing sorting with "by name, surname, birthdate", cause that's what I get after calling sort on list with Strings. Am I right ?
public List createListByName(Set set){
    List ret = new ArrayList<String>();
    String data = "";
    for(Object p: set){
        data = p + "\n";
        ret.add(data);
    }
    Collections.sort(ret);
    return ret;
}
But what with the rest ? Here's my Person :
class Person {
    private String firstname;
    private String lastname;
    )..)
    Person(String name, String surname, (..)){
        firstname = name;
        lastname = surname;
        (..)
    }
    @Override
    public String toString(){
        return firstname + " " + lastname + " " + (..);
    }
}