Here you can find the source of removeEmptyValues(Map
Parameter | Description |
---|---|
params | The map to strip empty values from. |
public static Map<String, String> removeEmptyValues(Map<String, String> params)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.Map; public class Main { /**//ww w. j a v a 2 s . co m * Strip all entries from <tt>params</tt> whose value is either * <tt>null</tt> or the empty string. * @param params The map to strip empty values from. * @return Returns the <tt>params</tt> map itself. */ public static Map<String, String> removeEmptyValues(Map<String, String> params) { 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; } }