Here you can find the source of putIfNotNull(final Map map, final String name, final String value)
Parameter | Description |
---|---|
map | the map to put in |
name | the key to use |
value | the value to add to the map |
public static void putIfNotNull(final Map map, final String name, final String value)
//package com.java2s; // Released under the Canoo Webtest license. import java.util.Map; public class Main { /**/*from w w w .j a va 2s . c om*/ * Utility for adding element to a map if not null: puts the value in the map if is not null, * does nothing if it is null. * * @param map the map to put in * @param name the key to use * @param value the value to add to the map */ public static void putIfNotNull(final Map map, final String name, final String value) { if (value != null) { map.put(name, value); } } }