如何将一个对象列表添加到另一个

时间:2015-10-14 07:30:23

标签: java list object

这是我的代码

我有eventBO list和eventReminderBo list ...我需要将eventReminderDaysBOs添加到eventBOs ...因为,我只需要返回eventBOs ....

public List<EventBO> getAllEventsFromUser(UserBO userBO) throws UserServiceException {
        try {
            List<EventBO> eventBOs = new ArrayList<>();
            List<EventReminderDaysBO> eventReminderDaysBOs =new ArrayList<>();
            UserDO userDO = mapper.mapUserBOToDO(userBO, new UserDO());
            List<EventDO> eventDOs = eventDAOImpl.getAllEventsFromUser(userDO);
            for (EventDO eventDo : eventDOs) {
                EventBO eventBO = mapper.mapEventDOToBO(eventDo, new EventBO());
                eventBOs.add(eventBO);
                List<EventReminderDaysDO> eventReminderDaysDOs = eventDAOImpl.getAllEventsReminderDays(eventBO.getEventId());
                eventReminderDaysBOs = mapper.mapEventReminderDaysDOToBO( eventReminderDaysDOs, new ArrayList<EventReminderDaysBO>());

                 //Here i need to add eventReminderDaysBOs to eventBOs
            }

            return eventBOs;
}

我无法正常添加它像eventBOs.addAll(eventReminderDaysBOs)...如何添加..请帮我查找代码..

这是我的eventBO

private long eventId;

private long ringeeUserId;

private String text;

private String place;

private String eventDate;

private String startTime;

private String endTime;

private int isActive;

private int isDelete;

private List<EventReminderDaysBO> eventReminderDaysBOs;

我在eventBO ...

中使用eventReminderDaysBOlist

0 个答案:

没有答案