异常:java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to XXX。
调用微服务接口后,对List进行遍历出错。java.util.LinkedHashMap cannot be cast XXVO>>>>>>>>>>>>>> java.lang.ClassCastException: java.util.LinkedHashMap cannot be XXVO at jav...
·
调用微服务接口后,对List进行遍历出错。
java.util.LinkedHashMap cannot be cast XXVO
>>>>>>>>>>>>>> java.lang.ClassCastException: java.util.LinkedHashMap cannot be XXVO at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
修改代码,需要将.LinkedHashMap转为Json字符串,然后在转为List。
BaseResultVo resultVo = consignMainApi.listByNoSet(map.keySet());
List<ConsignMainSimpleVO> simpleVOS1 = (List<ConsignMainSimpleVO>) resultVo.getData();
List<ConsignMainSimpleVO> simpleVOS = JSONArray.parseArray(JSON.toJSONString(simpleVOS1), ConsignMainSimpleVO.class);
simpleVOS = simpleVOS.stream().filter(t -> t.getCreateTime().after(DateUtil.parse(dto.getGmtCreateStart()))
&& t.getCreateTime().before(DateUtil.parse(dto.getGmtCreateEnd()))).collect(Collectors.toList());
更多推荐
已为社区贡献1条内容
所有评论(0)