Here you can find the source of listToMap(Object... objects)
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V> Map<K, V> listToMap(Object... objects)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { @SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V> Map<K, V> listToMap(Object... objects) { HashMap map = new HashMap(); Object key = null;/*w ww. j a v a2 s .c o m*/ for (final Object object : objects) { if (key == null) { key = object; } else { map.put(key, object); key = null; } } return map; } }