关于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

相关文章
相关标签/搜索