Here you can find the source of put(Map
public static void put(Map<String, Object> map, String key, Object value)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; public class Main { public static void put(Map<String, Object> map, String key, Object value) { Map<String, Object> m = resolve(map, key); String k = resolveKey(key); m.put(k, value);/*from ww w . jav a2 s .c om*/ } @SuppressWarnings("unchecked") private static Map<String, Object> resolve(Map<String, Object> map, String key) { String[] keys = key.split("\\.", 2); if (keys.length > 1) { if (!map.containsKey(keys[0])) map.put(keys[0], new HashMap<String, Object>()); return resolve((Map<String, Object>) map.get(keys[0]), keys[1]); } else return map; } private static String resolveKey(String key) { int ixDot = key.lastIndexOf('.'); if (ixDot > 0 && ixDot < key.length()) return key.substring(ixDot + 1); return key; } }