[Solved] How to count the number of keys in a map [closed]


Poorly phrased question, but if the values you have as keys (A1, A2, etc…) are String and you want to check by the first letter of the key, you can try something like this:

    int count = 0;
    for (String k : myMap.keySet()){
        if(k.startsWith("A")){
            count++;
        }
    }

4

solved How to count the number of keys in a map [closed]