Java Utililty Methods Map Put

List of utility methods to do Map Put

Description

The list of methods to do Map Put are organized into topic(s).

Method

voidputRowMap(Map map, String value)
put Row Map
map.put("field" + map.size(), value);
voidputSafelyMap(Map> pathFeaturesMap, K1 featureDescriptor, K2 pathId, E featureValue)
put Safely Map
putSafelyMap(pathFeaturesMap, featureDescriptor, pathId, featureValue, HashMap.class);
voidputShort(Map properties, String name, short value)
Utility method that puts the named short value to the given map.
properties.put(name, new Short(value));
voidputToListMap(Map mapOfLists, Object key, Object val)
put To List Map
List list = (List<?>) mapOfLists.get(key);
if (list == null) {
    list = new ArrayList<>();
    mapOfLists.put(key, list);
list.add(val);
voidputToMapIfNotNull(Map map, final String key, final String value)
put To Map If Not Null
if (value != null) {
    map.put(key, value);
voidputToMapMap(Map> map1, K1 key1, K2 key2, V value)
Puts a value into a map of maps.
Map<K2, V> map2 = map1.get(key1);
if (map2 == null) {
    map2 = new HashMap<>();
    map1.put(key1, map2);
map2.put(key2, value);
voidputUnique(Map map, long key, V v)
put Unique
synchronized (map) {
    while (map.get(key) != null) {
        key++;
    map.put(key, v);