Here you can find the source of createMapFromArgs(Object... args)
public static Map<String, Object> createMapFromArgs(Object... args)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, Object> createMapFromArgs(Object... args) { Map<String, Object> result = new HashMap<String, Object>(); if (args.length % 2 != 0) throw new IllegalArgumentException("There must be a pair number of arguments"); for (int i = 0; i < args.length; i = i + 2) { String keyArg = (String) args[i]; Object arg = args[i + 1]; result.put(keyArg, arg);/* w ww .j a v a 2 s .c om*/ } return result; } }