Android Map Value Get getString(Map map, T key)

Here you can find the source of getString(Map map, T key)

Description

get String from map, does not return a null

Parameter

Parameter Description
obj a parameter

Declaration

public static <T> String getString(Map<T, Object> map, T key) 

Method Source Code

//package com.java2s;

import java.util.Map;

public class Main {
    /**//  w  w w. j  a  v a2 s . co m
     * get String from map, does not return a null
     * @param obj
     * @return
     */
    public static <T> String getString(Map<T, Object> map, T key) {
        if (key != null) {
            Object obj = map.get(key);
            return String.valueOf(obj);//if obj is null, then ruturn "null"
        } else {
            return "";
        }
    }
}