Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有车辆数据对象返回字符串数组。我想转换或转换为 Arraylist BuyingDo 数据对象。我有 ArrayList objectList
我得到这样的价值
VehicleDo list[]=data.getList()
我正在这样转换
objectList=(ArrayList<BuyingDo)list
但它不工作任何人都可以告诉如何做到这一点
你的问题有点……嗯……不清楚。
我认为您的意思是:
List<VehicleDO> realList = Arrays.asList(list);
或这个:
List<BuyingDO> realList = new ArrayList<BuyingDO>(list.length); for (VehicleDO vdo : list){ realList.add((BuyingDO)vdo); }
当然,假设 VehicleDO 可以转换为 BuyingDO。
类似的东西?