Java Map Remove removeEmptyArray(Map map)

Here you can find the source of removeEmptyArray(Map map)

Description

remove Empty Array

License

Open Source License

Declaration

public static <K, V> Map<K, V> removeEmptyArray(Map<K, V> map) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Iterator;

import java.util.Map;

public class Main {
    public static <K, V> Map<K, V> removeEmptyArray(Map<K, V> map) {
        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();//from  w w  w.  ja v a 2s . c o  m
            }

        }

        return map;
    }
}

Related

  1. removeClassFromMap(final Map the_map, final String the_class_name)
  2. removeColor(Map windowColorCountMap, int windowColorCount, int lastColor)
  3. removeDefaultAnnotationPackage(final String packageName, final Map context)
  4. removeDoubleQuotes(Map argMap)
  5. removeElementFromJsonMap(Map toscaJson, String elementName)
  6. removeEmptyValues(Map params)
  7. removeExistingItemsFromProvided(Map existingItems, Map providedItems)
  8. removeFrom(Map map, K key)
  9. removeFromMap( Map map, K key, V value)