if (!events.hasNext()) {
return;
}
// Initialize the values needed to create a session for this group
final StandardEvent firstEvent = events.next();
long startTime = firstEvent.getTimestamp();
long endTime = firstEvent.getTimestamp();
int numEvents = 1;
// Inspect each event and keep track of start time, end time, and count
while (events.hasNext()) {
final StandardEvent event = events.next();
startTime = Math.min(startTime, event.getTimestamp());
endTime = Math.max(endTime, event.getTimestamp());
numEvents += 1;
}
// Create a session. Use the first event for fields that do not change
emitter.emit(Session.newBuilder() // same on all events: