Java tutorial
//package com.java2s; //License from project: LGPL import java.util.HashMap; import java.util.Map; public class Main { @SuppressWarnings("unchecked") public static <K, V> Map<K, V> map(Object... objects) { HashMap map = new HashMap(); Object key = null; for (final Object object : objects) { if (key == null) { key = object; } else { map.put(key, object); key = null; } } return map; } }