Sort by Year, Month, Date in Java (Android)
<p>I have done some searching around and haven't yet found an answer for this one. </p>

<p>I have an object <code>Task</code> that stores a date in a<code>StringBuilder</code> in the format <code>DD/MM/YYYY</code>. It comes from a <code>DateSpinner</code>. I chose to store it as <code>StringBuilder</code> because I completely forgot I was going to sort my list of <code>Task(s)</code> later on. </p>

<p>What I'm asking is effectively if it's better to rewrite the class and Activity code and store as a Date, then use a <code>Comparator</code>, or whether I should (as I'm currently attempting to do) create a temporary date for each object and then use this to sort the list</p>

<p>Google has shown me the radix sort, but I've not seen a way to do it to sort by three ways.</p>

<p>Task Class</p>

<pre><code>public Task(String identifier, String name, String description, ArrayList&lt;TeamMember&gt; members, int hours, StringBuilder date) {
    this.id = identifier;
    this.name = name;
    this.desc = description;
    this.members = new ArrayList&lt;&gt;();
    this.hours = hours;
    this.date = date;

}

public String getId() {
    return id;
}

public String getName() {
    return name;
}

public String getDesc() {
    return desc;
}

public ArrayList&lt;TeamMember&gt; getMembers() {
    return members;
}

public int getHours() {
    return hours;
}

public StringBuilder getDate() {
    return date;
}
} 
</code></pre>

<p>And my initial (WIP) attempt at sorting by date</p>

<pre><code>    for(Task t : tasks){
        String dateString = t.getDate().toString();
        List&lt;String&gt; date = Arrays.asList(dateString.split("/"));
        Calendar c =  Calendar.getInstance();
        c.set(Integer.parseInt(date.get(0)),Integer.parseInt(date.get(1))-1,Integer.parseInt(date.get(2)));
        Task temp = t;

    }
</code></pre>

<p>Any help would be greatly appreciated!</p>