Here you can find the source of putMapNotNullKey(Map
Parameter | Description |
---|---|
map | a parameter |
key | a parameter |
value | a parameter |
public static <K, V> boolean putMapNotNullKey(Map<K, V> map, K key, V value)
//package com.java2s; //License from project: Apache License import java.util.Map; public class Main { /**//from w w w .ja v a 2s. co m * add key-value pair to map, key need not null * * @param map * @param key * @param value * @return <ul> * <li>if map is null, return false</li> * <li>if key is null, return false</li> * <li>return {@link Map#put(Object, Object)}</li> * </ul> */ public static <K, V> boolean putMapNotNullKey(Map<K, V> map, K key, V value) { if (map == null || key == null) { return false; } map.put(key, value); return true; } }