01: // Released under the Canoo Webtest license.
02: package com.canoo.webtest.util;
03:
04: import java.util.Map;
05:
06: public class MapUtil {
07: /**
08: * Utility for adding element to a map if not null: puts the value in the map if is not null,
09: * does nothing if it is null.
10: *
11: * @param map the map to put in
12: * @param name the key to use
13: * @param value the value to add to the map
14: */
15: public static void putIfNotNull(final Map map, final String name,
16: final String value) {
17: if (value != null) {
18: map.put(name, value);
19: }
20: }
21: }
|