for (UserTicket userTicket : rawTickets) {
if (userTicket == null)
continue;
Event event = daos.getEventAccess().find(con, userTicket.getEventId());
if (event == null)
continue;
if (now.isBefore(event.getBeginDate()))
filtered.add(new Pair<UserTicket, Event>(userTicket, event));
}
// filtered を開始時刻順にソート
Collections.sort(filtered, new Comparator<Pair<UserTicket, Event>>() {
@Override
public int compare(Pair<UserTicket, Event> o1, Pair<UserTicket, Event> o2) {
long t1 = o1.getSecond().getBeginDate().getTime();
long t2 = o2.getSecond().getBeginDate().getTime();
if (t1 < t2)
return -1;
if (t1 == t2)
return 0;
return 1;
}
});
for (int i = 0; i < limit && i + offset < filtered.size(); ++i) {
UserTicket userTicket = filtered.get(i + offset).getFirst();
Event event = filtered.get(i + offset).getSecond();
EventTicket ticket = daos.getEventTicketAccess().find(con, userTicket.getTicketId());
if (ticket == null)
continue;