關於map中取值null處理

     

       Map<String, Object>  responseMap  = new HashMap<String, Object>();
        String  userMessageId = responseMap.get("USER_MESSAGE_ID")+"";
        String  userException = responseMap.get("USER_EXCEPTION_OBJECT")+"";
        System.out.println(null==(responseMap.get("USER_EXCEPTION_OBJECT")));
        System.out.println(responseMap.get("USER_MESSAGE_ID")==null);
        System.out.println((userException).equals("null"));
        System.out.println(userException.equals(null));spa

返回接口 接口

true
true
true
false開發

在map中取值爲null ,轉換成String的時候  null 變成了「null」get

開發謹記io

相關文章
相關標籤/搜索