hunterthompson
hunterthompson

Reputation: 1

Java - Find Object Group with Maximum Value

I have a list of cars for sale and I need to find the car make that has the highest average price. The car class looks like the following pseudocode:

class Car 
{
    string make;
    string model;
    double price;
}

So for example, if I had the following collection of cars:

Then obviously it should return that Skoda is the car make with the highest average price.

I want to do this using streams, however I'm a bit stumped as to where to start. Any help would be appreciated.

Upvotes: 0

Views: 25

Answers (0)

Related Questions