Java examples for java.util:Map Entry
Add Not Null Key And Value to a Map
//package com.java2s; import java.util.Map; public class Main { public static <K, V> boolean putMapNotNullKeyAndValue(Map<K, V> map, K key, V value) {/*from w w w .ja va2 s. c o m*/ if (map == null || key == null || value == null) { return false; } map.put(key, value); return true; } }