Java tutorial
//package com.java2s; import java.util.*; public class Main { public static int countCollectionValues(Map<?, ? extends Collection<?>> map) { int counter = 0; for (Collection<?> c : map.values()) { if (c != null) counter += c.size(); } return counter; } }