rewrite Hand.getRanks to use aggregate operations