compareTo method

int compareTo (
  1. EducationArticle date
)

Used to compare the dates of 2 different articles, returning an int representing the article that is most recent

Implementation

int compareTo(EducationArticle date) {
  DateTime d1 = new DateFormat("dd/MM/yyyy").parse(dateAdded);
  DateTime d2 = new DateFormat("dd/MM/yyyy").parse(date.dateAdded);
  return d2.compareTo(d1);
}