I have a list of ArrayList, and each arraylist consists of a date and a string. I want to sort the list according to the date in the arraylist. I tried looking for answers but cant find it online. Most of the examples are sorting a list of objects by date. Any suggestions?
public List<ArrayList> SuggestionReport() {
Query q = em.createQuery("SELECT s FROM SuggestionEntity s");
List<ArrayList> report = new ArrayList();
for (Object o : q.getResultList()) {
suggestionEntity = (SuggestionEntity) o;
ArrayList suggestion = new ArrayList();
suggestion.add(suggestionEntity.getSuggestionDate());
suggestion.add(suggestionEntity.getContent());
report.add(suggestion);
}
return report;
}
ps. I want to sort the list before returning the list