Question is how much it costs to create an ArrayList from a HashMap.values() Collection? Or creating the values Collection alone? Assuming Map.size() > 100k. Objects could also
To elaborate on @Bozho's solution you can just do.
int count = 0; for(Value value: map.values()) if(count++ % 5 == 0) // do something.