Here you can find the source of removeValuesFromMap(Map
public static <K, V> void removeValuesFromMap(Map<K, V> map, Collection<V> removed)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; public class Main { public static <K, V> void removeValuesFromMap(Map<K, V> map, Collection<V> removed) { Iterator<Entry<K, V>> it = map.entrySet().iterator(); while (it.hasNext()) { Entry<K, V> e = it.next(); if (removed.contains(e.getValue())) { it.remove();// w ww. j a v a 2 s . c om } } } }