Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Map; import java.util.TreeMap; public class Main { /** * Flatten a map of string arrays to a map of strings using the first item in each array. * * @param parameterMap * The map of string arrays. * @return A map of strings. */ public static Map<String, String> flatten(Map<String, String[]> parameterMap) { Map<String, String> result = new TreeMap<String, String>(); for (String key : parameterMap.keySet()) { result.put(key, parameterMap.get(key)[0]); } return result; } }