Java Map Remove removeFromMap( Map map, K key, V value)

Here you can find the source of removeFromMap( Map map, K key, V value)

Description

remove From Map

License

Apache License

Declaration

public static <K, V, C extends Collection<V>> boolean removeFromMap(
            Map<K, C> map, K key, V value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

import java.util.Map;

public class Main {
    public static <K, V, C extends Collection<V>> boolean removeFromMap(
            Map<K, C> map, K key, V value) {
        C collection = map.get(key);//from   w  w  w .j av  a 2s. co  m
        if (collection == null) {
            return false;
        }
        boolean success = collection.remove(value);
        if (success && collection.size() == 0) {
            return map.remove(key) != null;
        }
        return success;

    }
}

Related

  1. removeElementFromJsonMap(Map toscaJson, String elementName)
  2. removeEmptyArray(Map map)
  3. removeEmptyValues(Map params)
  4. removeExistingItemsFromProvided(Map existingItems, Map providedItems)
  5. removeFrom(Map map, K key)
  6. removeFromMapValues(final Map map, final Object value)
  7. removeGeneric( List> list)
  8. removeHeader(Map headers, String header)
  9. removeKeyAndConvertToListOfMaps( Object obj, String key)