i have a list that contains product items and when it was purchased. is it possible to use comparator java to first sort this list out by the product description, and then sort it by date purchased as well?
So far i can use it sort out the list in order of dates or description or another field but i want to know if it is possible to sort it by using multiple fields?
here is what i have so far that sorts the dates fine.
public int compare(Transaction aTransaction1, Transaction aTransaction2)
{
Date lTransactionDate1 = aTransaction1.getTransactionDate();
Date lTransactionDate2 = aTransaction2.getTransactionDate();
return lTransactionDate2.compareTo(lTransactionDate1);
}
Thanks in advance.