Java tutorial
//package com.java2s; import java.util.Collection; import java.util.HashMap; import java.util.Map.Entry; public class Main { public static <T, K> HashMap<T, K> toMap(Collection<Entry<T, K>> entryCollection) { HashMap<T, K> map = new HashMap<T, K>(); for (Entry<T, K> entry : entryCollection) { map.put(entry.getKey(), entry.getValue()); } return map; } }