我有一个 TicketBooking 类型的列表,我将其设置为 responseObject。当我尝试获取列表并转换回 TicketBooking 类型时,它正在抛出ClassCastException
。这是我的代码
List<TicketBooking> bookingDetailList = new ArrayList<TicketBooking>();
bookingDetailList.add(booking);
if(Utils.isNotNull(oldBooking))
bookingDetailList.add(oldBooking);
respObj.setObject(bookingDetailList);
从这个方法我返回respObj。
在调用方法中
List bookingList = new ArrayList();
bookingList.add(Arrays.asList(respObj.getObject()));
booking = (TicketBooking) bookingList.get(0);
投掷ClassCastException
请帮忙。