Here you can find the source of remove(Map
public static <K, V> boolean remove(Map<K, Set<V>> map, K key, V value)
//package com.java2s; // This source code is available under the terms of the Affero General Public License v3. import java.util.Collections; import java.util.Map; import java.util.Set; public class Main { public static <K, V> boolean remove(Map<K, Set<V>> map, K key, V value) { boolean removed = false; Set<V> values = map.get(key); if (values != null) { removed = values.remove(value); if (values.isEmpty()) map.remove(key);/*from www . ja v a 2s . co m*/ } return removed; } public static <K, V> Set<V> get(Map<K, Set<V>> map, K key) { Set<V> values = map.get(key); return values != null ? values : Collections.<V> emptySet(); } }