Here you can find the source of getFirstAsString(Map
public static <T> String getFirstAsString(Map<String, List<T>> multiValueMap, String key)
//package com.java2s; import java.util.*; public class Main { public static <T> String getFirstAsString(Map<String, List<T>> multiValueMap, String key) { return getFirstAsString(multiValueMap, key, false); }//w ww. j ava 2s.co m public static <T> String getFirstAsString(Map<String, List<T>> multiValueMap, String key, boolean stripQuotes) { List<T> values = multiValueMap.get(key); if (values == null || values.isEmpty()) return null; Object value = values.get(0); if (value == null) return null; return stripQuotes ? stripQuotes(value.toString()) : value.toString(); } public static String stripQuotes(String value) { if (value == null) return null; int start = 0, end = value.length(); if (value.charAt(0) == '"') start = 1; if (value.charAt(value.length() - 1) == '"') end = value.length() - 1; return value.substring(start, end); } }