static int multiSetTotalCountForKeys(MultiSet ms, Collection keys) { int n = 0; if (keys != null) for (A a : keys) n += ms.get(a); ret n; }