Here you can find the source of createMap(Object... objects)
public static <K, V> Map<K, V> createMap(Object... objects)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <K, V> Map<K, V> createMap(Object... objects) { if (isEmpty(objects)) { return Collections.emptyMap(); }/*www. j ava2s . c o m*/ if (objects.length % 2 != 0) { throw new IllegalArgumentException("objects should be even"); } Map<K, V> map = new HashMap<>(); for (int i = 0; i < objects.length; i++) { map.put((K) objects[i], (V) objects[++i]); } return map; } private static <E> boolean isEmpty(Collection<E> collection) { return (collection == null || collection.isEmpty()); } private static <E> boolean isEmpty(E[] array) { return (array == null || array.length == 0); } }