Java Utililty Methods Map Remove

List of utility methods to do Map Remove

Description

The list of methods to do Map Remove are organized into topic(s).

Method

voidremoveClassFromMap(final Map the_map, final String the_class_name)

Removes a class from a database of debugging-enabled classes.

if ("*".equals(the_class_name)) {
    the_map.clear();
} else
    the_map.remove(the_class_name);
intremoveColor(Map windowColorCountMap, int windowColorCount, int lastColor)
remove Color
boolean removedAColor = false;
Integer colorCount = windowColorCountMap.get(lastColor);
if (colorCount == 1)
    removedAColor = true;
windowColorCountMap.put(lastColor, colorCount - 1);
return removedAColor ? windowColorCount - 1 : windowColorCount;
voidremoveDefaultAnnotationPackage(final String packageName, final Map context)
remove Default Annotation Package
final List<String> list = getPackageListDecoration(context);
list.remove(packageName);
voidremoveDoubleQuotes(Map argMap)
Removes double quotes from arguments' value
String value = null;
for (String key : argMap.keySet()) {
    value = argMap.get(key);
    if (value != null && value.startsWith("\"") && value.endsWith("\"")) {
        argMap.put(key, value.substring(1, value.length() - 1));
voidremoveElementFromJsonMap(Map toscaJson, String elementName)
removes from Json map (toscaJson) first element found by name (elementName) note that this method could update the received argument toscaJson
for (Entry<String, Object> entry : toscaJson.entrySet()) {
    String key = entry.getKey();
    Object value = entry.getValue();
    if (key.equals(elementName)) {
        toscaJson.remove(elementName);
        return;
    } else if (value instanceof Map) {
        removeElementFromJsonMap((Map<String, Object>) value, elementName);
...
MapremoveEmptyArray(Map map)
remove Empty Array
if (map != null && !map.isEmpty()) {
    Iterator<Map.Entry<K, V>> i = map.entrySet().iterator();
    while (i.hasNext()) {
        Map.Entry<K, V> entry = i.next();
        V value = entry.getValue();
        if ((value instanceof Object[]) && ((Object[]) value).length == 0)
            i.remove();
return map;
MapremoveEmptyValues(Map params)
Strip all entries from params whose value is either null or the empty string.
for (Iterator<Map.Entry<String, String>> iter = params.entrySet().iterator(); iter.hasNext();) {
    Map.Entry<String, String> entry = iter.next();
    if (null == entry.getValue() || "".equals(entry.getValue())) {
        iter.remove();
return params;
MapremoveExistingItemsFromProvided(Map existingItems, Map providedItems)
remove Existing Items From Provided
Map<String, T> unexistingItems = new HashMap<String, T>(providedItems.size());
for (Entry<String, T> entry : providedItems.entrySet())
    if (!existingItems.containsKey(entry.getKey()))
        unexistingItems.put(entry.getKey(), entry.getValue());
return unexistingItems;
VremoveFrom(Map map, K key)
remove From
if (map == null) {
    return null;
return map.remove(key);
booleanremoveFromMap(Map map, K key, V value)
remove From Map
C collection = map.get(key);
if (collection == null) {
    return false;
boolean success = collection.remove(value);
if (success && collection.size() == 0) {
    return map.remove(key) != null;
return success;