java list.get(i) 报类型错误
下面代码块的行:SysUserTableConfig tableConfig = list.get(i);
报错:com.abc.entity.SysUserTableConfig cannot be cast to com.abc.entity.SysUserTableConfig
莫名其妙,list 的类型是 List<SysUserTableConfig>,为什么 get(i) 会报类型转换错误
public Map<String, ColumnConfigDTO> calculate(@RequestBody List<ColumnConfigDTO> record) { List<SysUserTableConfig> list = util.transSourceToTarget(record, SysUserTableConfig.class);
log.debug(list != null ? list.toString() : "NULL");
Integer userLoginId = getLoginUserId();
if (CollectionUtils.isEmpty(list)) return null;
for(int i=0;i<list.size();i++){
SysUserTableConfig tableConfig = list.get(i);
tableConfig.setSysUserId(userLoginId);
}
}
回答:
跟上次问的是不是同一个?……
https://segmentfault.com/q/10...
以上是 java list.get(i) 报类型错误 的全部内容, 来源链接: utcz.com/p/944498.html