You can't iterate a Map. only one of the three sets you can get out of it. You can get access to those three sets
via three of the Map's
methods. You can use the
map() mathod to take the price and count and produce a number. If you have the price as a primitive you may be able to get a Stream of primitives with a method called
mapToXYZ() and use its
sum() method, otherwise you would have to write a Collector with its three parts yourself, or use the
reduce() method which you will find examples of in the
package documentation.
Show us what you have tried and tell us how it is going. This is one of the circumstances where it is much easier to use an
IDE than the command line.