Here you can find the source of createMap(String key, Object value)
static Map<String, Object> createMap(String key, Object value)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; public class Main { static Map<String, Object> createMap(String key, Object value) { return createMap(new String[] { key }, new Object[] { value }); }//from w w w.jav a 2s . c o m static Map<String, Object> createMap(String[] keys, Object[] values) { if (keys.length != values.length) throw new IllegalArgumentException("Keys and values must have same size."); Map<String, Object> map = new HashMap<String, Object>(); for (int i = 0; i < keys.length; i++) { String key = keys[i]; Object value = values[i]; map.put(key, value); } return map; } }