ShowResponse build(DbSession session, List<DuplicationsParser.Block> blocks, @Nullable String branch, @Nullable String pullRequest) { ShowResponse.Builder response = ShowResponse.newBuilder(); Map<String, String> refByComponentKey = newHashMap(); blocks.stream() .map(block -> toWsDuplication(block, refByComponentKey)) .forEach(response::addDuplications); writeFiles(session, response, refByComponentKey, branch, pullRequest); return response.build(); }