Here you can find the source of map(String... args)
public static HashMap<String, Object> map(String... args)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; public class Main { public static HashMap<String, Object> map(String... args) { return map((Object[]) args); }/*from w w w. j a v a2 s. c o m*/ public static HashMap<String, Object> map(Object... args) { if (args.length % 2 == 1) new Exception("Odd number of arguments"); HashMap<String, Object> r = new HashMap<>(); for (int i = 0; i < args.length; i += 2) { r.put((String) args[i], args[i + 1]); } return r; } }