Java Map Remove removeValue(final Map map, final Object key, final Object value)

Here you can find the source of removeValue(final Map map, final Object key, final Object value)

Description

remove a value from a value list in a Map.

License

Open Source License

Parameter

Parameter Description
map the map.
key the key.
value the value to be removed from the list.

Declaration

static void removeValue(final Map map, final Object key,
        final Object value) 

Method Source Code

//package com.java2s;

import java.util.List;
import java.util.Map;

public class Main {
    /**/*from  w  ww . j  a  v a2s.c  om*/
     * remove a value from a value list in a Map.
     * 
     * @param map
     *            the map.
     * @param key
     *            the key.
     * @param value
     *            the value to be removed from the list.
     */
    static void removeValue(final Map map, final Object key,
            final Object value) {
        List values;
        if ((values = (List) map.get(key)) == null) {
            return;
        }
        values.remove(value);
        if (!values.isEmpty()) {
            map.put(key, values);
        } else {
            map.remove(key);
        }
    }
}

Related

  1. removeParamsForAlipaySign(Map map)
  2. removeParentBeans(Map parentBeans, Map beans)
  3. removePrivateColumns( Map contentValues)
  4. removeRownum(List> rows)
  5. removeTrailingNumber(Map names)
  6. removeValue(Map subject, String property, Map value, boolean propertyIsArray)
  7. removeValueFromAll(final Map map, final Object value)
  8. removeValueList(final Map> map, final K key, final V value)
  9. removeValuesFromMap(Map map, Collection removed)