Q:

Java Iterate through a HashMap> and for each Key count how many Values the Key has

I'm having problems on how to tackle this since I know a map has no specific order. I would think that you would iterate over the map's Keys and then check the value count by getting the size of the LinkedList since the Values to the Key are held in a LinkedList I can just call a size or length call for the LinkedList, but my main question is how to get inside the HashMap with an iterator first to do this?

A:

I suppose you have something like this :
    Map<Integer,List<Integer>> map = new HashMap<>();

You can just iterate very simply through all the values you have.
    for (List<Integer> values : map.values()){
        System.out.println(values.size());
    }

