Here you can find the source of putIfNotNull(Map
Parameter | Description |
---|---|
map | a parameter |
key | a parameter |
value | a parameter |
public static <K, V> void putIfNotNull(Map<K, V> map, K key, V value)
//package com.java2s; //License from project: Apache License import java.util.Map; public class Main { /**//w w w.j a va 2 s. c o m * * @param map * @param key * @param value */ public static <K, V> void putIfNotNull(Map<K, V> map, K key, V value) { if (map != null && key != null && value != null) map.put(key, value); } }