rankCards function
- List<
CreditCard> cards, - ShoppingCategory category
Implementation
void rankCards(List<CreditCard> cards, ShoppingCategory category) {
cards.sort((CreditCard cardLhs, CreditCard cardRhs) {
double maxLhsRate = getMaxRate(cardLhs, category);
double maxRhsRate = getMaxRate(cardRhs, category);
return maxRhsRate.compareTo(maxLhsRate);
});
}