Code review comment: We should remove the commented code? 

Code before review:
private AnalyzeBatchActionsResult toAnalyzeTasks(AnalyzeJobState analyzeJobState) {
TasksStateTasks tasksStateTasks = analyzeJobState.getTasks();
final List<TasksStateTasksEntityRecognitionPiiTasksItem> piiTasksItems =
tasksStateTasks.getEntityRecognitionPiiTasks();
final List<TasksStateTasksEntityRecognitionTasksItem> entityRecognitionTasksItems =
tasksStateTasks.getEntityRecognitionTasks();
final List<TasksStateTasksKeyPhraseExtractionTasksItem> keyPhraseExtractionTasks =
tasksStateTasks.getKeyPhraseExtractionTasks();
IterableStream<RecognizeEntitiesActionResult> recognizeEntitiesActionResults = null;
IterableStream<RecognizePiiEntitiesActionResult> recognizePiiEntitiesActionResults = null;
IterableStream<ExtractKeyPhrasesActionResult> extractKeyPhrasesActionResults = null;
if (!CoreUtils.isNullOrEmpty(entityRecognitionTasksItems)) {
recognizeEntitiesActionResults = IterableStream.of(entityRecognitionTasksItems.stream()
.map(taskItem -> {
RecognizeEntitiesActionResult actionResult = new RecognizeEntitiesActionResult();
RecognizeEntitiesActionResultPropertiesHelper.setResult(actionResult,
toRecognizeEntitiesResultCollectionResponse(taskItem.getResults()));
TextAnalyticsActionResultPropertiesHelper.setCompletedAt(actionResult,
taskItem.getLastUpdateDateTime());
return actionResult;
})
.collect(Collectors.toList()));
}
if (!CoreUtils.isNullOrEmpty(piiTasksItems)) {
recognizePiiEntitiesActionResults = IterableStream.of(piiTasksItems.stream()
.map(taskItem -> {
RecognizePiiEntitiesActionResult actionResult = new RecognizePiiEntitiesActionResult();
RecognizePiiEntitiesActionResultPropertiesHelper.setResult(actionResult,
toRecognizePiiEntitiesResultCollection(taskItem.getResults()));
TextAnalyticsActionResultPropertiesHelper.setCompletedAt(actionResult,
taskItem.getLastUpdateDateTime());
return actionResult;
})
.collect(Collectors.toList()));
}
if (!CoreUtils.isNullOrEmpty(keyPhraseExtractionTasks)) {
extractKeyPhrasesActionResults = IterableStream.of(keyPhraseExtractionTasks.stream()
.map(taskItem -> {
ExtractKeyPhrasesActionResult actionResult = new ExtractKeyPhrasesActionResult();
ExtractKeyPhrasesActionResultPropertiesHelper.setResult(actionResult,
toExtractKeyPhrasesResultCollection(taskItem.getResults()));
TextAnalyticsActionResultPropertiesHelper.setCompletedAt(actionResult,
taskItem.getLastUpdateDateTime());
return actionResult;
})
.collect(Collectors.toList()));
}
final AnalyzeBatchActionsResult analyzeBatchActionsResult = new AnalyzeBatchActionsResult();
final RequestStatistics requestStatistics = analyzeJobState.getStatistics();
TextDocumentBatchStatistics batchStatistics = null;
if (requestStatistics != null) {
batchStatistics = new TextDocumentBatchStatistics(
requestStatistics.getDocumentsCount(), requestStatistics.getErroneousDocumentsCount(),
requestStatistics.getValidDocumentsCount(), requestStatistics.getTransactionsCount()
);
}
AnalyzeBatchActionsResultPropertiesHelper.setStatistics(analyzeBatchActionsResult, batchStatistics);
AnalyzeBatchActionsResultPropertiesHelper.setRecognizeEntitiesActionResults(analyzeBatchActionsResult,
recognizeEntitiesActionResults);
AnalyzeBatchActionsResultPropertiesHelper.setRecognizePiiEntitiesActionResults(analyzeBatchActionsResult,
recognizePiiEntitiesActionResults);
AnalyzeBatchActionsResultPropertiesHelper.setExtractKeyPhrasesActionResults(analyzeBatchActionsResult,
extractKeyPhrasesActionResults);
return analyzeBatchActionsResult;
}


Code after addressing the review:
private AnalyzeBatchActionsResult toAnalyzeTasks(AnalyzeJobState analyzeJobState) {
TasksStateTasks tasksStateTasks = analyzeJobState.getTasks();
final List<TasksStateTasksEntityRecognitionPiiTasksItem> piiTasksItems =
tasksStateTasks.getEntityRecognitionPiiTasks();
final List<TasksStateTasksEntityRecognitionTasksItem> entityRecognitionTasksItems =
tasksStateTasks.getEntityRecognitionTasks();
final List<TasksStateTasksKeyPhraseExtractionTasksItem> keyPhraseExtractionTasks =
tasksStateTasks.getKeyPhraseExtractionTasks();
IterableStream<RecognizeEntitiesActionResult> recognizeEntitiesActionResults = null;
IterableStream<RecognizePiiEntitiesActionResult> recognizePiiEntitiesActionResults = null;
IterableStream<ExtractKeyPhrasesActionResult> extractKeyPhrasesActionResults = null;
if (!CoreUtils.isNullOrEmpty(entityRecognitionTasksItems)) {
recognizeEntitiesActionResults = IterableStream.of(entityRecognitionTasksItems.stream()
.map(taskItem -> {
RecognizeEntitiesActionResult actionResult = new RecognizeEntitiesActionResult();
RecognizeEntitiesActionResultPropertiesHelper.setResult(actionResult,
toRecognizeEntitiesResultCollectionResponse(taskItem.getResults()));
TextAnalyticsActionResultPropertiesHelper.setCompletedAt(actionResult,
taskItem.getLastUpdateDateTime());
return actionResult;
})
.collect(Collectors.toList()));
}
if (!CoreUtils.isNullOrEmpty(piiTasksItems)) {
recognizePiiEntitiesActionResults = IterableStream.of(piiTasksItems.stream()
.map(taskItem -> {
RecognizePiiEntitiesActionResult actionResult = new RecognizePiiEntitiesActionResult();
RecognizePiiEntitiesActionResultPropertiesHelper.setResult(actionResult,
toRecognizePiiEntitiesResultCollection(taskItem.getResults()));
TextAnalyticsActionResultPropertiesHelper.setCompletedAt(actionResult,
taskItem.getLastUpdateDateTime());
return actionResult;
})
.collect(Collectors.toList()));
}
if (!CoreUtils.isNullOrEmpty(keyPhraseExtractionTasks)) {
extractKeyPhrasesActionResults = IterableStream.of(keyPhraseExtractionTasks.stream()
.map(taskItem -> {
ExtractKeyPhrasesActionResult actionResult = new ExtractKeyPhrasesActionResult();
ExtractKeyPhrasesActionResultPropertiesHelper.setResult(actionResult,
toExtractKeyPhrasesResultCollection(taskItem.getResults()));
TextAnalyticsActionResultPropertiesHelper.setCompletedAt(actionResult,
taskItem.getLastUpdateDateTime());
return actionResult;
})
.collect(Collectors.toList()));
}
final AnalyzeBatchActionsResult analyzeBatchActionsResult = new AnalyzeBatchActionsResult();
final RequestStatistics requestStatistics = analyzeJobState.getStatistics();
TextDocumentBatchStatistics batchStatistics = null;
if (requestStatistics != null) {
batchStatistics = new TextDocumentBatchStatistics(
requestStatistics.getDocumentsCount(), requestStatistics.getErroneousDocumentsCount(),
requestStatistics.getValidDocumentsCount(), requestStatistics.getTransactionsCount()
);
}
AnalyzeBatchActionsResultPropertiesHelper.setStatistics(analyzeBatchActionsResult, batchStatistics);
AnalyzeBatchActionsResultPropertiesHelper.setRecognizeEntitiesActionResults(analyzeBatchActionsResult,
recognizeEntitiesActionResults);
AnalyzeBatchActionsResultPropertiesHelper.setRecognizePiiEntitiesActionResults(analyzeBatchActionsResult,
recognizePiiEntitiesActionResults);
AnalyzeBatchActionsResultPropertiesHelper.setExtractKeyPhrasesActionResults(analyzeBatchActionsResult,
extractKeyPhrasesActionResults);
return analyzeBatchActionsResult;
}