Here you can find the source of putIfNull(Map map, Object key, Object defaultValue)
@SuppressWarnings("all") public static void putIfNull(Map map, Object key, Object defaultValue)
//package com.java2s; import java.util.Map; public class Main { @SuppressWarnings("all") public static void putIfNull(Map map, Object key, Object defaultValue) { if (key == null) throw new IllegalArgumentException("key must be not null"); if (map == null) throw new IllegalArgumentException("map must be not null"); if (map.get(key) == null) { map.put(key, defaultValue);/*from w w w . ja va 2 s .c o m*/ } } }