You can get the answer from TotalSpentByCustomer.scala where it shows the code for getting the total amount spent by each customer
I have included my code PurchaseByCustomer.scala which shows my solution
Now sort your results by amount spent!
Review our sorted word count example - it's the same idea.
Instead now sort the list starting with the customer with the largest amount of total purchase, which you can also sort by ascending or descending
I have included the sorting code inside PurchaseByCustomer.scala
Last updated 7 years ago