ImmutableSet.Builder<Event> eventsBuilder = ImmutableSet.builder();
ImmutableMap.Builder<Document, EventMap> knownHistogramsBuilder = ImmutableMap.builder();
List<EventMap> histograms = new ArrayList<EventMap>(knowns.size());
for(Document known : knowns){
EventMap histogram = new EventMap(known);
eventsBuilder.addAll(histogram.uniqueEvents());
histograms.add(histogram);
knownHistogramsBuilder.put(known, histogram);
}
events = eventsBuilder.build();
knownHistograms = knownHistogramsBuilder.build();