Here you can find the source of map(Object... objs)
public static Map map(Object... objs)
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { public static Map map(Object... objs) { return toMap(objs); }// w ww . j av a2 s . co m public static Map toMap(Object... objs) { Map map = new HashMap(); Object key = null; for (int i = 0; i < objs.length; i++) { if (i % 2 == 0) { key = objs[i]; } else { map.put(key, objs[i]); } } return map; } }