Here you can find the source of removeNullPair(Map map)
public static void removeNullPair(Map map)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; import java.util.Map; public class Main { public static void removeNullPair(Map map) { List<Object> nullPairKeyList = new ArrayList<>(); for (Object key : map.keySet()) { if ("".equals(key) || map.get(key) == null) { nullPairKeyList.add(key); }/*from w w w . jav a 2 s . c o m*/ } for (Object nullPairKey : nullPairKeyList) { map.remove(nullPairKey); } } }