private void mergeInPlace(GroupDataSummary other) { if (other == null) { return; } // This check is unnecessary since all merges will have valid (or at least non empty data) from the very fact // that they were created (see update above). GroupData targetData = other.getData(); if (targetData == null) { return; } // In-place, so not copying targetData if (data == null) { data = targetData; } else { data.combine(targetData); } }
@Override public List<BulletRecord> getRecords() { merge(); List<BulletRecord> result = new ArrayList<>(); SketchIterator<GroupDataSummary> iterator = this.result.iterator(); for (int count = 0; iterator.next() && count < maxSize; count++) { GroupData data = iterator.getSummary().getData(); result.add(data.getAsBulletRecord(provider)); } return result; }