Source:
private List<FeedbackResponseCommentAttributes> analyzeAndGetAffectedComments() { println("Analyzing comments and their search documents..."); List<FeedbackResponseCommentAttributes> allComments = FeedbackResponseCommentsLogic.inst().getAllFeedbackResponseComments(); List<FeedbackResponseCommentAttributes> commentsToFix = new ArrayList<>(); int numberOfDocuments = 0; int numberOfUnaffectedDocuments = 0; LoopHelper loopHelper = new LoopHelper(batchSize, "comments analyzed."); for (FeedbackResponseCommentAttributes comment : allComments) { loopHelper.recordLoop(); Document document = getDocument(comment); if (document == null) { continue; } numberOfDocuments++; String sampleDateString = extractSampleDateString(document); if (isInDateFormat(sampleDateString, oldDateFormat)) { commentsToFix.add(comment); } else { if (isInDateFormat(sampleDateString, newDateFormat)) { numberOfUnaffectedDocuments++; } else { println("Unrecognised date format (" + sampleDateString + ") for:\n" + comment); } } } println("\n################# Analysis Results #################"); println("Total number of comments: " + loopHelper.getCount()); println("Total number of documents: " + numberOfDocuments + "\n"); println("Number of documents already in new date format: " + numberOfUnaffectedDocuments); println("Number of documents in unrecognizable date format: " + (numberOfDocuments - commentsToFix.size() - numberOfUnaffectedDocuments) + "\n"); println("Number of documents in old date format: " + commentsToFix.size()); println("####################################################\n"); return commentsToFix; }

Target:
private List<FeedbackResponseCommentAttributes> analyzeAndGetAffectedComments() { println("Analyzing comments and their search documents..."); List<FeedbackResponseCommentAttributes> allComments = FeedbackResponseCommentsLogic.inst().getAllFeedbackResponseComments(); List<FeedbackResponseCommentAttributes> commentsToFix = new ArrayList<>(); int numberOfDocuments = 0; int numberOfUnaffectedDocuments = 0; LoopHelper loopHelper = new LoopHelper(batchSize, "comments analyzed."); for (FeedbackResponseCommentAttributes comment : allComments) { loopHelper.recordLoop(); Document document = getDocument(comment); if (document == null) { continue; } numberOfDocuments++; String sampleDateString = extractSampleDateString(document); if (isInDateFormat(sampleDateString, oldDateFormat)) { commentsToFix.add(comment); } else if (isInDateFormat(sampleDateString, newDateFormat)) { numberOfUnaffectedDocuments++; } else { println("Unrecognised date format (" + sampleDateString + ") for:\n" + comment); } } println("\n################# Analysis Results #################"); println("Total number of comments: " + loopHelper.getCount()); println("Total number of documents: " + numberOfDocuments + "\n"); println("Number of documents already in new date format: " + numberOfUnaffectedDocuments); println("Number of documents in unrecognizable date format: " + (numberOfDocuments - commentsToFix.size() - numberOfUnaffectedDocuments) + "\n"); println("Number of documents in old date format: " + commentsToFix.size()); println("####################################################\n"); return commentsToFix; }