[英]Not able to cast response to particular list object in Java
I'm getting response from a webservice as 我正在从Web服务获取响应
[{Id=100, value=1815401000238}, {Id=101, value=1815401000244}]
Here I'm casting the value to list object as 在这里,我将值强制转换为列出对象
List<Map<String, String>> leadIds
Here I'm passing the response to the method 在这里,我将响应传递给方法
ServiceUtil.Status(leadIds);
leadIds has the above response leadIds具有以上响应
Here is the method definition 这是方法的定义
public Response updateStatus(List<Map<String, String>> leadIds) {
So that I can cast and iterate. 这样我就可以进行投射和迭代。 But ,it throws me error
但是,这使我出错
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.util.Map$Entry
What exactly should be casted? 究竟应该投什么? I guess its a list object.
我猜它是一个列表对象。
进行转换时,尝试使用List<LinkedHashMap<String, String>>
而不是List<Map<String, String>>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.