Java tutorial
//package com.java2s; //License from project: BSD License import java.util.*; public class Main { public static <T> HashMap<T, T> toMap(T[][] ts) { HashMap<T, T> out = new HashMap<T, T>(ts.length); for (int i = 0; i < ts.length; i++) out.put(ts[i][0], ts[i][1]); return out; } }