// Overriding the compare method to sort the dueDate public int compare(Task t1, Task t2) { int result = 1; Date d1 = t1.getDueDate(); Date d2 = t2.getDueDate(); if (d1 != null & d2 != null) { result = t1.getDueDate().compareTo(t2.getDueDate()); } else if (d1 == null) { result = -1; } return result; }
// Overriding the compareTo method public int compareTo(Task t) { return (this.getName()).compareTo(t.getName()); }