auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Group group) throws InternalErrorException { if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { List<Integer> attrIds = new ArrayList<>(); for (Service service : services) { attrIds.addAll(getRequiredAttributeIds(service)); <START> } <END> List<Attribute> attrs = perun.getCacheManager().getAttributesByIds(attrIds, new Holder(group.getId(), Holder.HolderType.GROUP)); return this.setValuesOfAttributes(sess, attrs, group, null); } try { return jdbc.query("select " + getAttributeMappingSelectQuery("grp") + " from attr_names " + "join service_required_attrs on id=service_required_attrs.attr_id and service_required_attrs.service_id " + Compatibility.getStructureForInClause() + "left join group_attr_values grp on id=grp.attr_id and group_id=? " + "where namespace in (?,?,?,?)", new SingleBeanAttributeRowMapper<>(sess, this, group), services.stream().map(Service::getId).collect(Collectors.toList()), group.getId(), AttributesManager.NS_GROUP_ATTR_CORE, AttributesManager.NS_GROUP_ATTR_DEF, AttributesManager.NS_GROUP_ATTR_OPT, AttributesManager.NS_GROUP_ATTR_VIRT); } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }</code><technical_language>unique set of attribute ids</technical_language>

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Group group) { if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { Set<Integer> attrIds = new HashSet<>(); for (Service service : services) { attrIds.addAll(getRequiredAttributeIds(service)); } List<Attribute> attrs = perun.getCacheManager().getAttributesByIds(new ArrayList<>(attrIds), new Holder(group.getId(), Holder.HolderType.GROUP)); return this.setValuesOfAttributes(sess, attrs, group, null); } try { return jdbc.query("select " + getAttributeMappingSelectQuery("grp") + " from attr_names " + "join service_required_attrs on id=service_required_attrs.attr_id and service_required_attrs.service_id " + Compatibility.getStructureForInClause() + "left join group_attr_values grp on id=grp.attr_id and group_id=? " + "where namespace in (?,?,?,?)", new SingleBeanAttributeRowMapper<>(sess, this, group), services.stream().map(Service::getId).collect(Collectors.toList()), group.getId(), AttributesManager.NS_GROUP_ATTR_CORE, AttributesManager.NS_GROUP_ATTR_DEF, AttributesManager.NS_GROUP_ATTR_OPT, AttributesManager.NS_GROUP_ATTR_VIRT); } catch (EmptyResultDataAccessException ex) { return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
<code><START> private static Optional<TimeValue> getTimeValue(Optional<TimeValue> primaryValue, Optional<TimeValue> safetyValue) { <END> if (!primaryValue.isPresent()) { return safetyValue; } return primaryValue; }</code><technical_language>this need static</technical_language>

Target:
private Optional<TimeValue> getTimeValue(Optional<TimeValue> primaryValue, Optional<TimeValue> safetyValue) { if (!primaryValue.isPresent()) { return safetyValue; } return primaryValue; }
Source:
<code>private Integer getLookupAttributeIndex( EditorAttribute editorAttribute, EditorEntityType editorEntityType) { String editorAttributeId = editorAttribute.getId(); List<EditorAttributeIdentifier> lookupAttributes = editorEntityType.getLookupAttributes(); int index = IntStream.range(0, lookupAttributes.size()) .map(idx -> lookupAttributes.get(idx).getId().equals(editorAttributeId) ? idx : -1) .reduce(Integer::max) .orElse(-1); <START> return index != -1 ? index : null; <END> }</code><technical_language>I do int index = editorEntityType.getLookupAttributes() .stream() .map(EditorAttributeIdentifier::getId) .collect(toList()) .indexOf(editorAttributeIdentifier.getId());</technical_language>

Target:
private Integer getLookupAttributeIndex( EditorAttribute editorAttribute, EditorEntityType editorEntityType) { String editorAttributeId = editorAttribute.getId(); int index = editorEntityType .getLookupAttributes() .stream() .map(EditorAttributeIdentifier::getId) .collect(toList()) .indexOf(editorAttributeId); return index != -1 ? index : null; }
Source:
<code>public void testNoSDRbuildingAddition() { Record record = factory.newRecord(); DataField df = factory.newDataField("856", ' ', ' '); df.addSubfield(factory.newSubfield('u', "<LINK_1>")); record.addVariableField(df); df = factory.newDataField("856", ' ', ' '); df.addSubfield(factory.newSubfield('u', "<LINK_0>")); record.addVariableField(df); <START> solrFldMapTest.assertSolrFldHasNoValue(record, fldName, "SDR"); <END> }</code><technical_language>SDR Stanford Digital Repository</technical_language>

Target:
public void testNoSDRbuildingAddition() { Record record = factory.newRecord(); DataField df = factory.newDataField("856", ' ', ' '); df.addSubfield(factory.newSubfield('u', "<LINK_1>")); record.addVariableField(df); df = factory.newDataField("856", ' ', ' '); df.addSubfield(factory.newSubfield('u', "<LINK_0>")); record.addVariableField(df); solrFldMapTest.assertSolrFldHasNoValue(record, fldName, "SDR"); solrFldMapTest.assertSolrFldHasNoValue(record, fldName, "Stanford Digital Repository"); }
Source:
<code><START> public void setUp() { <END> TmfEventMatching.registerMatchObject(new TcpEventMatching()); TmfEventMatching.registerMatchObject(new TcpLttngEventMatching()); }</code><technical_language>a BeforeClass static (it try run it) I wondering this passed Hudson, remembered perf tests run, yet..</technical_language>

Target:
public static void setUp() { TmfEventMatching.registerMatchObject(new TcpEventMatching()); TmfEventMatching.registerMatchObject(new TcpLttngEventMatching()); }
Source:
<code>private void writeMeetings() { nextSheet("Meetings", 2, 1, false); nextRow(); nextHeaderCell("Topic"); nextHeaderCell("Duration"); nextHeaderCell("Speakers"); nextHeaderCell("Content"); nextHeaderCell("Required attendance list"); nextHeaderCell("Preferred attendance list"); for (Meeting meeting : solution.getMeetingList()) { nextRow(); nextCell().setCellValue(meeting.getTopic()); nextCell().setCellValue(meeting.getDurationInGrains() * TimeGrain.GRAIN_LENGTH_IN_MINUTES); nextCell().setCellValue(meeting.getSpeakerList() == null ? "" : String.join(", ", meeting.getSpeakerList().stream() .map(speaker -> speaker.getFullName()) .collect(toList()))); nextCell().setCellValue(meeting.getContent() == null ? "" : meeting.getContent()); nextCell().setCellValue( String.join(", ", meeting.getRequiredAttendanceList().stream() .map(requiredAttendance -> requiredAttendance.getPerson().getFullName()) .collect(toList()))); nextCell().setCellValue( String.join(", ", meeting.getPreferredAttendanceList().stream() .map(preferredAttendance -> preferredAttendance.getPerson().getFullName()) <START> .collect(toList()))); <END> } autoSizeColumnsWithHeader(); }</code><technical_language>replaced joining(", ")</technical_language>

Target:
private void writeMeetings() { nextSheet("Meetings", 1, 1, false); nextRow(); nextHeaderCell("Topic"); nextHeaderCell("Group"); nextHeaderCell("Duration"); nextHeaderCell("Speakers"); nextHeaderCell("Content"); nextHeaderCell("Required attendance list"); nextHeaderCell("Preferred attendance list"); for (Meeting meeting : solution.getMeetingList()) { nextRow(); nextCell().setCellValue(meeting.getTopic()); nextCell().setCellValue(meeting.isEntireGroupMeeting() ? "Y" : ""); nextCell().setCellValue(meeting.getDurationInGrains() * TimeGrain.GRAIN_LENGTH_IN_MINUTES); nextCell().setCellValue(meeting.getSpeakerList() == null ? "" : meeting.getSpeakerList().stream() .map(Person::getFullName) .collect(joining(", "))); nextCell().setCellValue(meeting.getContent() == null ? "" : meeting.getContent()); nextCell().setCellValue( meeting.getRequiredAttendanceList().stream() .map(requiredAttendance -> requiredAttendance.getPerson().getFullName()) .collect(joining(", "))); nextCell().setCellValue( meeting.getPreferredAttendanceList().stream() .map(preferredAttendance -> preferredAttendance.getPerson().getFullName()) .collect(joining(", "))); } setColumnsWidthHeader(5000); }
Source:
<code>public VMImage getImage(final String id) { String[] fields = VMImageToImage.decodeFieldsFromUniqueId(id); <START> boolean custom = fields.length == 6 ? true : false; <END> if (custom) { String storage = fields[2]; String vhd = fields[3]; VMImage ref = VMImage.create(azureGroup, storage, vhd, null, "", fields[4], fields[5]); String key = api.getStorageAccountApi(azureGroup).getKeys(storage).key1(); if (BlobHelper.customImageExists(storage, key)) return ref; else return null; } String location = fields[0]; String publisher = fields[1]; String offer = fields[2]; String sku = fields[3]; OSImageApi osImageApi = api.getOSImageApi(location); List<Version> versions = osImageApi.listVersions(publisher, offer, sku); if (!versions.isEmpty()) { return VMImage.create(publisher, offer, sku, versions.get(0).name(), location); } return null; }</code><technical_language>boolean custom = fields.length == 6;</technical_language>

Target:
public VMImage getImage(final String id) { VMImage image = VMImageToImage.decodeFieldsFromUniqueId(id); if (image.custom()) { String key = api.getStorageAccountApi(azureGroup).getKeys(image.storage()).key1(); if (BlobHelper.customImageExists(image.storage(), key)) return image; else return null; } String location = image.location(); String publisher = image.publisher(); String offer = image.offer(); String sku = image.sku(); OSImageApi osImageApi = api.getOSImageApi(location); List<Version> versions = osImageApi.listVersions(publisher, offer, sku); if (!versions.isEmpty()) { return VMImage.create(publisher, offer, sku, versions.get(0).name(), location); } return null; }
Source:
<code>public static OrcTester quickOrcTester() { OrcTester orcTester = new OrcTester(); orcTester.structTestsEnabled = true; orcTester.mapTestsEnabled = true; orcTester.listTestsEnabled = true; orcTester.nullTestsEnabled = true; orcTester.missingStructFieldsTestsEnabled = true; orcTester.skipBatchTestsEnabled = true; <START> orcTester.formats = ImmutableSet.of(ORC_12, ORC_11); <END> orcTester.compressions = ImmutableSet.of(ZLIB); return orcTester; }</code><technical_language>Accidental change</technical_language>

Target:
public static OrcTester quickOrcTester() { OrcTester orcTester = new OrcTester(); orcTester.structTestsEnabled = true; orcTester.mapTestsEnabled = true; orcTester.listTestsEnabled = true; orcTester.nullTestsEnabled = true; orcTester.missingStructFieldsTestsEnabled = true; orcTester.skipBatchTestsEnabled = true; orcTester.formats = ImmutableSet.of(ORC_12, ORC_11, DWRF); orcTester.compressions = ImmutableSet.of(ZLIB); return orcTester; }
Source:
<code>private void saveLocalFile() { mFile.setFileName(mNewName); if (mFile.isDown()) { boolean isAvailableOffline = mFile.getAvailableOfflineStatus() == OCFile.AvailableOfflineStatus.AVAILABLE_OFFLINE; if (isAvailableOffline) { pauseObservation(); } String oldPath = mFile.getStoragePath(); File f = new File(oldPath); String parentStoragePath = f.getParent(); if (!parentStoragePath.endsWith(File.separator)) parentStoragePath += File.separator; if (f.renameTo(new File(parentStoragePath + mNewName))) { String newPath = parentStoragePath + mNewName; mFile.setStoragePath(newPath); if (isAvailableOffline) { resumeObservation(); } getStorageManager().deleteFileInMediaScan(oldPath); FileDataStorageManager.triggerMediaScan(newPath); <START> } <END> } getStorageManager().saveFile(mFile); }</code><technical_language>Please delete static label triggerMediaScan calling getStorageManager().triggerMediaScan(newPath);</technical_language>

Target:
private void saveLocalFile() { mFile.setFileName(mNewName); if (mFile.isDown()) { boolean isAvailableOffline = mFile.getAvailableOfflineStatus() == OCFile.AvailableOfflineStatus.AVAILABLE_OFFLINE; if (isAvailableOffline) { pauseObservation(); } String oldPath = mFile.getStoragePath(); File f = new File(oldPath); String parentStoragePath = f.getParent(); if (!parentStoragePath.endsWith(File.separator)) parentStoragePath += File.separator; if (f.renameTo(new File(parentStoragePath + mNewName))) { String newPath = parentStoragePath + mNewName; mFile.setStoragePath(newPath); if (isAvailableOffline) { resumeObservation(); } getStorageManager().deleteFileInMediaScan(oldPath); getStorageManager().triggerMediaScan(newPath); } } getStorageManager().saveFile(mFile); }
Source:
<code>public void execute(JobExecutionContext jobExecutionContext) { LOGGER.info("executing..."); try { JobDetail jobDetail = jobExecutionContext.getJobDetail(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); String jobId = jobDetail.getKey().getName(); String eventType = jobDataMap.getString(SchedulerConstants.EVENT_TYPE_KEY_NAME); Map<String, Object> params = jobDataMap.getWrappedMap(); params.remove(SchedulerConstants.EVENT_TYPE_KEY_NAME); params.put(SchedulerConstants.JOB_ID_KEY, jobId); <START> params.put(TasksEventParser.CUSTOM_PARSER_EVENT_KEY, SchedulerEventParser.PARSER_NAME); <END> MotechEvent motechEvent = new MotechEvent(eventType, params); LOGGER.info("Sending Motech Event Message: " + motechEvent); SchedulerContext schedulerContext; try { schedulerContext = jobExecutionContext.getScheduler().getContext(); } catch (SchedulerException e) { LOGGER.error("Can not execute job. Can not get Scheduler Context", e); return; } ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get("applicationContext"); EventRelay eventRelay = applicationContext.getBean(EventRelay.class); eventRelay.sendEventMessage(motechEvent); } catch (RuntimeException e) { LOGGER.error("Job execution failed.", e); } }</code><technical_language>I idea of putting this job executions, limit this</technical_language>

Target:
public void execute(JobExecutionContext jobExecutionContext) { LOGGER.info("executing..."); try { JobDetail jobDetail = jobExecutionContext.getJobDetail(); JobDataMap jobDataMap = jobDetail.getJobDataMap(); String jobId = jobDetail.getKey().getName(); String eventType = jobDataMap.getString(SchedulerConstants.EVENT_TYPE_KEY_NAME); Map<String, Object> params = jobDataMap.getWrappedMap(); params.remove(SchedulerConstants.EVENT_TYPE_KEY_NAME); params.put(MotechSchedulerService.JOB_ID_KEY, jobId); params.put(TasksEventParser.CUSTOM_PARSER_EVENT_KEY, SchedulerEventParser.PARSER_NAME); MotechEvent motechEvent = new MotechEvent(eventType, params); LOGGER.info("Sending Motech Event Message: " + motechEvent); SchedulerContext schedulerContext; try { schedulerContext = jobExecutionContext.getScheduler().getContext(); } catch (SchedulerException e) { LOGGER.error("Can not execute job. Can not get Scheduler Context", e); return; } ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get("applicationContext"); EventRelay eventRelay = applicationContext.getBean(EventRelay.class); eventRelay.sendEventMessage(motechEvent); } catch (RuntimeException e) { LOGGER.error("Job execution failed.", e); } }
Source:
<code>private void fireInvokeCallback(final Invoker<?> invoker, final Invocation invocation) { final ConsumerMethodModel.AsyncMethodInfo asyncMethodInfo = getAsyncMethodInfo(invoker, invocation); <START> if (asyncMethodInfo == null) return; <END> final Method onInvokeMethod = asyncMethodInfo.getOninvokeMethod(); final Object onInvokeInst = asyncMethodInfo.getOninvokeInstance(); if (onInvokeMethod == null && onInvokeInst == null) { return; } if (onInvokeMethod == null || onInvokeInst == null) { throw new IllegalStateException("service:" + invoker.getUrl().getServiceKey() + " has a oninvoke callback config , but no such " + (onInvokeMethod == null ? "method" : "instance") + " found. url:" + invoker.getUrl()); } if (!onInvokeMethod.isAccessible()) { onInvokeMethod.setAccessible(true); } Object[] params = invocation.getArguments(); try { onInvokeMethod.invoke(onInvokeInst, params); } catch (InvocationTargetException e) { fireThrowCallback(invoker, invocation, e.getTargetException()); } catch (Throwable e) { fireThrowCallback(invoker, invocation, e); } }</code><technical_language>pls. consider {...}</technical_language>

Target:
private void fireInvokeCallback(final Invoker<?> invoker, final Invocation invocation) { final ConsumerMethodModel.AsyncMethodInfo asyncMethodInfo = getAsyncMethodInfo(invoker, invocation); if (asyncMethodInfo == null) { return; } final Method onInvokeMethod = asyncMethodInfo.getOninvokeMethod(); final Object onInvokeInst = asyncMethodInfo.getOninvokeInstance(); if (onInvokeMethod == null && onInvokeInst == null) { return; } if (onInvokeMethod == null || onInvokeInst == null) { throw new IllegalStateException("service:" + invoker.getUrl().getServiceKey() + " has a oninvoke callback config , but no such " + (onInvokeMethod == null ? "method" : "instance") + " found. url:" + invoker.getUrl()); } if (!onInvokeMethod.isAccessible()) { onInvokeMethod.setAccessible(true); } Object[] params = invocation.getArguments(); try { onInvokeMethod.invoke(onInvokeInst, params); } catch (InvocationTargetException e) { fireThrowCallback(invoker, invocation, e.getTargetException()); } catch (Throwable e) { fireThrowCallback(invoker, invocation, e); } }
Source:
<code>private void checkDirectoryForXmlFiles(final String name, final String xmlModelName) { final Class clazz; try { clazz = Class.forName(xmlModelName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } final Path directory = Paths.get(ConfigFileConstants.getFilePathString(), name); if (!Files.exists(directory)) { return; <START> } <END> try (final DirectoryStream<Path> stream = Files.newDirectoryStream(directory, "*.xml")) { for (final Path entry : stream) { try { JaxbUtils.unmarshal(clazz, entry.toFile(), true); } catch (final Exception e) { throw new ConfigCheckValidationException(e); } } } catch (final IOException e) { throw new ConfigCheckValidationException(e); } }</code><technical_language>check for directory try load class? is need load class, if needs done</technical_language>

Target:
private void checkDirectoryForXmlFiles(final String name, final String xmlModelName) { final Path directory = Paths.get(ConfigFileConstants.getFilePathString(), name); if (!Files.exists(directory)) { return; } final Class clazz; try { clazz = Class.forName(xmlModelName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } try (final DirectoryStream<Path> stream = Files.newDirectoryStream(directory, "*.xml")) { for (final Path entry : stream) { try { JaxbUtils.unmarshal(clazz, entry.toFile(), true); } catch (final Exception e) { throw new ConfigCheckValidationException("File " + entry.toString() + " not valid!", e); } } } catch (final IOException e) { throw new ConfigCheckValidationException(e); } }
Source:
<code>public YearWeek minusWeeks(long weeksToSubtract) { if (weeksToSubtract == 0) { return this; } if (weeksToSubtract < 0) { <START> return plusWeeks(-weeksToSubtract); <END> } YearWeek yearWeek = this; while (weeksToSubtract-- > 0) { if (yearWeek.week > 1) { yearWeek = YearWeek.of(yearWeek.year, yearWeek.week - 1); } else { yearWeek = YearWeek.of(yearWeek.year - 1, weekRange(yearWeek.year - 1)); } } return yearWeek; }</code><technical_language>This fail if weeksToSubtract is Long.MIN_VALUE</technical_language>

Target:
public YearWeek minusWeeks(long weeksToSubtract) { if (weeksToSubtract == 0) { return this; } LocalDate mondayOfWeek = atDay(DayOfWeek.MONDAY).minusWeeks(weeksToSubtract); return YearWeek.from(mondayOfWeek); }
Source:
<code>private void analyzeXPathForRuleChain(final XPathEvaluator xpathEvaluator) { final Expression expr = xpathExpression.getInternalExpression(); boolean useRuleChain = true; List<Expression> subexpressions = new ArrayList<>(); SplitUnions unions = new SplitUnions(); unions.visit(expr); if (unions.getExpressions().isEmpty()) { subexpressions.add(expr); } else { subexpressions.addAll(unions.getExpressions()); } for (Expression subexpression : subexpressions) { RuleChainAnalyzer rca = new RuleChainAnalyzer(xpathEvaluator.getConfiguration()); Expression modified = rca.visit(subexpression); if (rca.getRootElement() != null) { addExpressionForNode(rca.getRootElement(), modified); } else { useRuleChain = false; break; } } if (useRuleChain) { super.ruleChainVisits.addAll(nodeNameToXPaths.keySet()); } else { nodeNameToXPaths.clear(); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Unable to use RuleChain for XPath: " + xpath); } } <START> addExpressionForNode(AST_ROOT, xpathExpression.getInternalExpression()); <END> }</code><technical_language>I this undermines benefits of rulechain? effectively traverse for rulechain visit, for tree, *more* traversals, while tree visit suffices</technical_language>

Target:
private void analyzeXPathForRuleChain(final XPathEvaluator xpathEvaluator) { final Expression expr = xpathExpression.getInternalExpression(); boolean useRuleChain = true; Iterable<Expression> subexpressions = RuleChainAnalyzer.splitUnions(expr); for (Expression subexpression : subexpressions) { RuleChainAnalyzer rca = new RuleChainAnalyzer(xpathEvaluator.getConfiguration()); Expression modified = rca.visit(subexpression); if (rca.getRootElement() != null) { addExpressionForNode(rca.getRootElement(), modified); } else { useRuleChain = false; break; } } if (useRuleChain) { super.ruleChainVisits.addAll(nodeNameToXPaths.keySet()); } else { nodeNameToXPaths.clear(); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Unable to use RuleChain for XPath: " + xpath); } } addExpressionForNode(AST_ROOT, xpathExpression.getInternalExpression()); }
Source:
<code>public static VdcParameter create(String name, Class javaType, String guidStr) { Guid guid = new Guid(guidStr); if (parametersMap.containsKey(guid)) { <START> throw new InvalidParameterGuidException(name, guidStr, parametersMap.get(guid)); <END> } parametersMap.put(guid, new VdcParameter(name, javaType, guid)); return parametersMap.get(guid); }</code><technical_language>do need guidStr this VdcParameter right</technical_language>

Target:
public static VdcParameter create(String name, Class javaType, String guidStr) { Guid guid = new Guid(guidStr); synchronized (parametersMap) { if (parametersMap.containsKey(guid)) { throw new InvalidParameterGuidException(name, parametersMap.get(guid)); } parametersMap.put(guid, new VdcParameter(name, javaType, guid)); } return parametersMap.get(guid); }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { <START> if (url == null || (!url.startsWith(HTTP) && !url.startsWith(HTTPS))) { <END> response.sendError(response.SC_NOT_FOUND, "Cannot proxy, no URL is configured."); } else { URLConnection connection; try { connection = createConnection(new URL(mergeQuery(url, request.getQueryString()))); } catch(Exception e) { throw new ServletException(e); } connection.connect(); try { if (connection instanceof HttpURLConnection) { response.setStatus(((HttpURLConnection)connection).getResponseCode()); } for (Map.Entry<String, List<String>> entry : connection.getHeaderFields().entrySet()) { if (entry.getKey() != null) { boolean first = true; for (String value : entry.getValue()) { if (first) { first = false; response.setHeader(entry.getKey(), value); } else { response.addHeader(entry.getKey(), value); } } } } copy(connection.getInputStream(), response.getOutputStream()); } finally { if (connection instanceof HttpURLConnection) { ((HttpURLConnection)connection).disconnect(); } } } }</code><technical_language>user of this class set url if empty, leaving null proper functioning..</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (url == null) { response.sendError(response.SC_NOT_FOUND, "Cannot proxy, no URL is configured."); } else { URLConnection connection; try { connection = createConnection(new URL(mergeQuery(url, request.getQueryString()))); } catch(Exception e) { throw new ServletException(e); } connection.connect(); try { if (connection instanceof HttpURLConnection) { response.setStatus(((HttpURLConnection)connection).getResponseCode()); } for (Map.Entry<String, List<String>> entry : connection.getHeaderFields().entrySet()) { if (entry.getKey() != null) { boolean first = true; for (String value : entry.getValue()) { if (first) { first = false; response.setHeader(entry.getKey(), value); } else { response.addHeader(entry.getKey(), value); } } } } copy(connection.getInputStream(), response.getOutputStream()); } finally { if (connection instanceof HttpURLConnection) { ((HttpURLConnection)connection).disconnect(); } } } }
Source:
<code>private static @Nullable TmfEventsTable getExperimentEventTable( final TmfExperiment experiment, final Composite parent, final int cacheSize) { String commonTraceType = getCommonTraceType(experiment); if (commonTraceType != null) { return getEventTable(experiment.getTraces()[0], parent, cacheSize); } ITmfTrace[] traces = experiment.getTraces(); Set<TmfEventTableColumn> cols = new LinkedHashSet<>(); boolean wantsDefaultCols = false; for (ITmfTrace trace : traces) { if (TmfTraceTypeUIUtils.getEventTableColumns(trace) == null) { <START> wantsDefaultCols = true; <END> break; } } if (wantsDefaultCols) { cols.addAll(TmfEventsTable.DEFAULT_COLUMNS); } for (ITmfTrace trace : traces) { Collection<? extends TmfEventTableColumn> traceCols = TmfTraceTypeUIUtils.getEventTableColumns(trace); if (traceCols != null) { cols.addAll(traceCols); } } return new TmfEventsTable(parent, cacheSize, cols); }</code><technical_language>do cols.addAll()</technical_language>

Target:
private static @NonNull TmfEventsTable getExperimentEventTable( final TmfExperiment experiment, final Composite parent, final int cacheSize) { String commonTraceType = getCommonTraceType(experiment); if (commonTraceType != null) { return getEventTable(experiment.getTraces()[0], parent, cacheSize); } ITmfTrace[] traces = experiment.getTraces(); Set<TmfEventTableColumn> cols = new LinkedHashSet<>(); for (ITmfTrace trace : traces) { Collection<? extends TmfEventTableColumn> traceCols = TmfTraceTypeUIUtils.getEventTableColumns(trace); if (traceCols == null) { cols.addAll(TmfEventsTable.DEFAULT_COLUMNS); } else { cols.addAll(traceCols); } } return new TmfEventsTable(parent, cacheSize, cols); }
Source:
<code>public void put(TraceEventType eventType, TraceEventWrapper beginWrapper, long beginTime, String eventId) { if (TraceEventType.DURATION_BEGIN.equals(eventType)) { <START> m_durationEvents.addLast(new Pair<TraceEventWrapper, Long>(beginWrapper, beginTime)); <END> return; } if (TraceEventType.ASYNC_BEGIN.equals(eventType)) { m_asyncEvents.put(eventId, new Pair<TraceEventWrapper, Long>(beginWrapper, beginTime)); return; } return; }</code><technical_language>Pair.of(beginWrapper, beginTime)</technical_language>

Target:
public void put(TraceEventType eventType, TraceEventWrapper beginWrapper, long beginTime, String eventId) { if (TraceEventType.DURATION_BEGIN.equals(eventType)) { m_durationEvents.addLast(Pair.of(beginWrapper, beginTime)); return; } if (TraceEventType.ASYNC_BEGIN.equals(eventType)) { m_asyncEvents.put(eventId, Pair.of(beginWrapper, beginTime)); return; } return; }
Source:
<code>private Scanner createMockScanner(final TreeMap<Key,Value> data) { final ScannerState state = new ScannerState(); Scanner scanner = createMock(Scanner.class); expect(scanner.iterator()).andAnswer(new IAnswer<Iterator<Entry<Key,Value>>>() { @Override public Iterator<Entry<Key,Value>> answer() throws Throwable { Iterator<Entry<Key,Value>> iter = data.entrySet().iterator(); <START> iter = Iterators.filter(iter, state.getScanPredicate()::test); <END> return iter; } }).anyTimes(); state.rangeCapture = Capture.newInstance(); scanner.setRange(capture(state.rangeCapture)); expectLastCall().anyTimes(); scanner.fetchColumn(anyObject(Text.class), anyObject(Text.class)); expectLastCall().anyTimes(); scanner.fetchColumnFamily(anyObject(Text.class)); expectLastCall().anyTimes(); replay(scanner); return scanner; }</code><technical_language>TIL. I do a reference returned a method</technical_language>

Target:
private Scanner createMockScanner(final TreeMap<Key,Value> data) { final ScannerState state = new ScannerState(); Scanner scanner = createMock(Scanner.class); expect(scanner.iterator()).andAnswer(new IAnswer<Iterator<Entry<Key,Value>>>() { @Override public Iterator<Entry<Key,Value>> answer() throws Throwable { Iterator<Entry<Key,Value>> iter = data.entrySet().iterator(); final Predicate<Entry<Key,Value>> scanPredicate = state.getScanPredicate(); iter = Iterators.filter(iter, scanPredicate::test); return iter; } }).anyTimes(); state.rangeCapture = Capture.newInstance(); scanner.setRange(capture(state.rangeCapture)); expectLastCall().anyTimes(); scanner.fetchColumn(anyObject(Text.class), anyObject(Text.class)); expectLastCall().anyTimes(); scanner.fetchColumnFamily(anyObject(Text.class)); expectLastCall().anyTimes(); replay(scanner); return scanner; }
Source:
<code>public void testInsertWhileNotEnable() { store.setValue(EclipsePreferenceConstants.SHOW_CONTRIBUTION_ANNOTATIONS, false); <START> final User ALICE_TEST_USER = new User(new JID("ALICE_TEST_USER@test"), false, false, null); <END> manager.insertAnnotation(model, 5, 7, ALICE_TEST_USER); assertEquals(0, getAnnotationCount(model)); }</code><technical_language>Remove static variable instead</technical_language>

Target:
public void testInsertWhileNotEnable() { store.setValue(EclipsePreferenceConstants.SHOW_CONTRIBUTION_ANNOTATIONS, false); manager.insertAnnotation(model, 5, 7, ALICE_TEST_USER); assertEquals(0, getAnnotationCount(model)); }
Source:
<code>private static HolidayCalendarId create(String name) { if (!name.contains("+")) { return CACHE.computeIfAbsent(name, n -> new HolidayCalendarId(name)); } List<HolidayCalendarId> ids = Splitter.on('+').splitToList(name).stream() .filter(n -> !n.equals(HolidayCalendarIds.NO_HOLIDAYS.getName())) .map(n -> HolidayCalendarId.of(n)) .distinct() .sorted(comparing(HolidayCalendarId::getName)) .collect(toList()); String normalizedName = Joiner.on('+').join(ids); BiFunction<HolidayCalendarId, ReferenceData, HolidayCalendar> resolver = (id, refData) -> { HolidayCalendar cal = refData.queryValueOrNull(id); if (cal != null) { return cal; } cal = HolidayCalendars.NO_HOLIDAYS; for (HolidayCalendarId splitId : ids) { HolidayCalendar splitCal = refData.queryValueOrNull(splitId); if (splitCal == null) { <START> throw new ReferenceDataNotFoundException(""); <END> } cal = cal.combinedWith(splitCal); } return cal; }; HolidayCalendarId id = CACHE.computeIfAbsent(normalizedName, n -> new HolidayCalendarId(normalizedName, resolver)); CACHE.putIfAbsent(name, id); return id; }</code><technical_language>Is this exception message intentionally blank</technical_language>

Target:
private static HolidayCalendarId create(String name) { if (!name.contains("+")) { return CACHE.computeIfAbsent(name, n -> new HolidayCalendarId(name)); } List<HolidayCalendarId> ids = Splitter.on('+').splitToList(name).stream() .filter(n -> !n.equals(HolidayCalendarIds.NO_HOLIDAYS.getName())) .map(n -> HolidayCalendarId.of(n)) .distinct() .sorted(comparing(HolidayCalendarId::getName)) .collect(toList()); String normalizedName = Joiner.on('+').join(ids); BiFunction<HolidayCalendarId, ReferenceData, HolidayCalendar> resolver = (id, refData) -> { HolidayCalendar cal = refData.queryValueOrNull(id); if (cal != null) { return cal; } cal = HolidayCalendars.NO_HOLIDAYS; for (HolidayCalendarId splitId : ids) { HolidayCalendar splitCal = refData.queryValueOrNull(splitId); if (splitCal == null) { throw new ReferenceDataNotFoundException(Messages.format( "Reference data not found for '{}' of type 'HolidayCalendarId' when finding '{}'", splitId, id)); } cal = cal.combinedWith(splitCal); } return cal; }; HolidayCalendarId id = CACHE.computeIfAbsent(normalizedName, n -> new HolidayCalendarId(normalizedName, resolver)); CACHE.putIfAbsent(name, id); return id; }
Source:
<code>protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select" + " mm.id" + " from manual_measures mm" + " where" + " mm.component_uuid is null" + " or not exists (" + " select" + " 1" + " from projects p" + " where" + " p.uuid = mm.component_uuid" + " and p.scope = ?" + " and p.qualifier in (?,?,?,?)" + <START> " )") <END> .setString(1, SCOPE_PROJECT) .setString(2, QUALIFIER_PROJECT) .setString(3, QUALIFIER_VIEW) .setString(4, QUALIFIER_MODULE) .setString(5, QUALIFIER_SUBVIEW); massUpdate.update("delete from manual_measures where id = ?"); massUpdate.rowPluralName("orphan properties"); massUpdate.execute(CleanOrphanRowsInManualMeasures::handle); }</code><technical_language>p.enabled=true added</technical_language>

Target:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select" + " mm.id" + " from manual_measures mm" + " where" + " mm.component_uuid is null" + " or not exists (" + " select" + " 1" + " from projects p" + " where" + " p.uuid = mm.component_uuid" + " and p.scope = ?" + " and p.qualifier in (?,?,?,?)" + " and p.enabled = ?" + " )") .setString(1, SCOPE_PROJECT) .setString(2, QUALIFIER_PROJECT) .setString(3, QUALIFIER_VIEW) .setString(4, QUALIFIER_MODULE) .setString(5, QUALIFIER_SUBVIEW) .setBoolean(6, true); massUpdate.update("delete from manual_measures where id = ?"); massUpdate.rowPluralName("orphan properties"); massUpdate.execute(CleanOrphanRowsInManualMeasures::handle); }
Source:
<code>private static boolean isIntegerType(GoType type) { <START> return intTypeNames.contains(type.getText()); <END> }</code><technical_language>Type a stub, a good idea getText</technical_language>

Target:
private static boolean isIntegerType(GoType type) { if (type.getTypeReferenceExpression() == null) { return false; } return intTypeNames.contains(type.getTypeReferenceExpression().getText()); }
Source:
<code>public void untag(final String... tags) throws IOException { <START> final List<String> args = new ArrayList<String>(); <END> args.add("remove"); args.add(this.jid); for (final String tag: tags) { args.add(tag); } this.client.call( LuaCommand.TAG.toString(), args); }</code><technical_language>java final List<String> args = new ArrayList<>();</technical_language>

Target:
public void untag(final String... tags) throws IOException { final List<String> args = new ArrayList<>(); args.add("remove"); args.add(this.jid); Collections.addAll(args, tags); this.client.call( LuaCommand.TAG.toString(), args); }
Source:
<code>public Double getValue() { try { <START> estimator.accumulate(cx); <END> } catch (ExecException ex) { throw new RuntimeException("Error while accumulating sample frequency: " + ex); } return estimator.getEntropy(); }</code><technical_language>getValue() is supposed called, I work correctly if is called twice. is, set cx zero accumulate</technical_language>

Target:
public Double getValue() { try { this.estimator.accumulate(this.cx); } catch (ExecException ex) { throw new RuntimeException("Error while accumulating sample frequency: " + ex); } return this.estimator.getEntropy(); }
Source:
<code>private void setActionPerformer(View view, ViewAction<T> action) { if (action.getTriggerType() == TriggerType.CLICK) { new ClickActionPerformer<T>(action).setupListener(view); } else if (action.getTriggerType() == TriggerType.LONG_CLICK) { new LongClickActionPerformer<T>(action).setupListener(view); } else if (action.getTriggerType() == TriggerType.TOUCH || action.getTriggerType() == TriggerType.TOUCH_DOWN || action.getTriggerType() == TriggerType.TOUCH_UP) { new TouchActionPerformer<T>(action).setupListener(view); } else if (action.getTriggerType() == TriggerType.ITEM_CLICK) { <START> new ItemClickActionPerformer<T>(action).setupListener(view); <END> } }</code><technical_language>is a ListItemClickActionPerformer. here</technical_language>

Target:
private void setActionPerformer(View view, ViewAction<T> action) { if (action.getTriggerType() == TriggerType.CLICK) { new ClickActionPerformer<T>(action).setupListener(view); } else if (action.getTriggerType() == TriggerType.LONG_CLICK) { new LongClickActionPerformer<T>(action).setupListener(view); } else if (action.getTriggerType() == TriggerType.TOUCH || action.getTriggerType() == TriggerType.TOUCH_DOWN || action.getTriggerType() == TriggerType.TOUCH_UP) { new TouchActionPerformer<T>(action).setupListener(view); } else if (action.getTriggerType() == TriggerType.CLICK_LIST_ITEM) { new ListItemClickActionPerformer<T>(action).setupListener(view); } }
Source:
<code>private DataInputAssociation input(Object value) { DataInput target = readInputFrom(inputDefinition.name(), typeDef); Assignment assignment = assignment(value.toString(), target.getId()); <START> DataInputAssociation dataInputAssociation = <END> associationOf(assignment, target); return dataInputAssociation; }</code><technical_language>Variable dataInputAssociation is defined class variable. Variable name method confusion</technical_language>

Target:
private DataInputAssociation input(Object value) { DataInput target = readInputFrom(inputDefinition.name(), typeDef); Assignment assignment = assignment(value.toString(), target.getId()); DataInputAssociation association = associationOf(assignment, target); return association; }
Source:
<code>public void activate() { <START> logger.debug("neohub activated"); <END> }</code><technical_language>please decrease log level trace remove statement</technical_language>

Target:
public void activate() { }
Source:
<code>public void testGetValueFromFilterConfig() { final TestConfigurationFilter filter = new TestConfigurationFilter(); final MockServletContext ctx = new MockServletContext(); ctx.addInitParameter("service", "<LINK_1>"); final MockFilterConfig filterConfig = new MockFilterConfig(ctx); filterConfig.addInitParameter(AbstractConfigurationFilter.PARAM_NAME_CONFIG_FILE, CONFIG_FILE_PATH); filterConfig.addInitParameter("serverName", "<LINK_0>"); assertEquals(filter.getPropertyFromInitParams(filterConfig, "serverName", null), "<LINK_0>"); <START> assertNotNull(filter.getPropertyFromInitParams(filterConfig, "service", null)); <END> }</code><technical_language>I expected: assertEquals(filter.getPropertyFromInitParams(filterConfig, "service", null), "<LINK_1>");</technical_language>

Target:
public void testGetValueFromFilterConfig() { final TestConfigurationFilter filter = new TestConfigurationFilter(); final MockServletContext ctx = new MockServletContext(); ctx.addInitParameter("service", "<LINK_1>"); final MockFilterConfig filterConfig = new MockFilterConfig(ctx); filterConfig.addInitParameter(AbstractConfigurationFilter.PARAM_NAME_CONFIG_FILE, CONFIG_FILE_PATH); filterConfig.addInitParameter("serverName", "<LINK_0>"); assertEquals(filter.getPropertyFromInitParams(filterConfig, "serverName", null), filterConfig.getInitParameter("serverName")); assertEquals(filter.getPropertyFromInitParams(filterConfig, "service", null), ctx.getInitParameter("service")); }
Source:
<code>public HadoopIndexTask(@JsonProperty("config") HadoopDruidIndexerConfig config) { super( <START> String.format("index_hadoop_%s_interval_%s", config.getDataSource(), new DateTime().now()), <END> config.getDataSource(), JodaUtils.umbrellaInterval(config.getIntervals()) ); if (config.isUpdaterJobSpecSet()) { throw new IllegalArgumentException("UpDaterJobSpec is defined"); } this.config = config; }</code><technical_language>new DateTime().now() is new DateTime(), latter. (side note- now() is a static method, DateTime.now() new DateTime().now())</technical_language>

Target:
public HadoopIndexTask( @JsonProperty("config") HadoopDruidIndexerConfig config ) { super( String.format("index_hadoop_%s_%s", config.getDataSource(), new DateTime()), config.getDataSource(), JodaUtils.umbrellaInterval(config.getIntervals()) ); Preconditions.checkArgument(config.getSegmentOutputDir() == null, "segmentOutputPath must be absent"); Preconditions.checkArgument(config.getJobOutputDir() == null, "workingPath must be absent"); Preconditions.checkArgument(!config.isUpdaterJobSpecSet(), "updaterJobSpec must be absent"); this.config = config; }
Source:
<code>static boolean <START> isMemberAccessibleFrom(int modifier, @Nonnull <END> JClassOrInterface declaringType, @CheckForNull JType accessedVia, @Nonnull JDefinedClassOrInterface accessor) { if (JModifier.isPublic(modifier)) { return true; } if (accessor.isSameType(declaringType)) { return true; } if (JModifier.isPrivate(modifier)) { return accessor == declaringType; } if (declaringType.getEnclosingPackage() == accessor.getEnclosingPackage()) { return true; } if (!JModifier.isProtected(modifier)) { return false; } if (!accessor.canBeSafelyUpcast(declaringType)) { return false; } if (JModifier.isStatic(modifier)) { return true; } return accessedVia instanceof JReferenceType && ((JReferenceType) accessedVia).canBeSafelyUpcast(accessor); }</code><technical_language>takes object of type HasModifier pass modifier is</technical_language>

Target:
static boolean isMemberAccessibleFrom(int modifier, @Nonnull JClassOrInterface declaringType, @CheckForNull JType accessedVia, @Nonnull JDefinedClassOrInterface accessor) { if (JModifier.isPublic(modifier)) { return true; } if (accessor.isSameType(declaringType)) { return true; } if (JModifier.isPrivate(modifier)) { return false; } if (declaringType.getEnclosingPackage() == accessor.getEnclosingPackage()) { return true; } if (!JModifier.isProtected(modifier)) { return false; } if (!accessor.canBeSafelyUpcast(declaringType)) { return false; } if (JModifier.isStatic(modifier)) { return true; } return accessedVia instanceof JReferenceType && ((JReferenceType) accessedVia).canBeSafelyUpcast(accessor); }
Source:
<code>public Action<?, ?> datalakeFullResoreInProgress() { return new AbstractSdxAction<>(SdxEvent.class) { @Override protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxEvent payload) { return SdxContext.from(flowParameters, payload); } @Override protected void doExecute(SdxContext context, SdxEvent payload, Map<Object, Object> variables) { LOGGER.info("Full datalake restore is in progress for ", payload.getResourceId()); String operationId = (String) variables.get(OPERATION_ID); sdxDatabaseDrService.updateDatabaseStatusEntry(operationId, SdxOperationStatus.SUCCEEDED, null); <START> sendEvent(context, DatalakeFullRestoreWaitRequest.from(context, operationId)); <END> String restoreId = (String) variables.get(RESTORE_ID); sdxDatabaseDrService.updateDatabaseStatusEntry(operationId, SdxOperationStatus.SUCCEEDED, null); sendEvent(context, DatalakeFullRestoreWaitRequest.from(context, restoreId)); } @Override protected Object getFailurePayload(SdxEvent payload, Optional<SdxContext> flowContext, Exception ex) { return DatalakeDatabaseRestoreFailedEvent.from(payload, ex); } }; }</code><technical_language>is this line duplicated</technical_language>

Target:
public Action<?, ?> datalakeFullResoreInProgress() { return new AbstractSdxAction<>(SdxEvent.class) { @Override protected SdxContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, SdxEvent payload) { return SdxContext.from(flowParameters, payload); } @Override protected void doExecute(SdxContext context, SdxEvent payload, Map<Object, Object> variables) { LOGGER.info("Full datalake restore is in progress for ", payload.getResourceId()); String operationId = (String) variables.get(OPERATION_ID); String restoreId = (String) variables.get(RESTORE_ID); sdxDatabaseDrService.updateDatabaseStatusEntry(operationId, SdxOperationStatus.SUCCEEDED, null); sendEvent(context, DatalakeFullRestoreWaitRequest.from(context, restoreId)); } @Override protected Object getFailurePayload(SdxEvent payload, Optional<SdxContext> flowContext, Exception ex) { return DatalakeDatabaseRestoreFailedEvent.from(payload, ex); } }; }
Source:
<code>public Attribute<?> getAttribute() throws OseeCoreException { <START> Attribute<?> attribute = null; <END> Collection<Attribute<Object>> localAttributes = getArtifact().getAttributes(getAttributeType()); for (Attribute<Object> localAttribute : localAttributes) { if (localAttribute.getId() == attrId) { attribute = localAttribute; } } return attribute; }</code><technical_language>artifact.getAttributeById(attrUuid, includeDeleted)</technical_language>

Target:
public Attribute<?> getAttribute() throws OseeCoreException { return getArtifact().getAttributeById(attrId, false); }
Source:
<code>public static int findOpenPort() { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } catch (IOException e) { <START> return 3000; <END> } }</code><technical_language>I sense try recover this exception, log fail in sensor (i.e. skip analysis)</technical_language>

Target:
public static int findOpenPort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } }
Source:
<code>public void testEquals() { ABCD cp1 = new ABCD(); <START> ABCD cp2 = cp1; <END> assertThat(cp1.equals(cp2), is(true)); }</code><technical_language>[x] Is this good solution? Please [CodePoints(String... strings)](<LINK_0> [CodePoints#equals](<LINK_1> . This test is expected Codepoints#equals return true. pattern of return true is follows: - Object#equals = This object same. - Set<Integer>#equals = This codepoint set codepoint set same. --- modified. 015dc4e4128f00429c8b779e7b419d8a0b3d9d77</technical_language>

Target:
public void testEquals() { ABCD cp1 = new ABCD(); ABCD cp2 = new ABCD(); ABCD cp3 = cp1; assertThat(cp1.equals(cp2), is(true)); assertThat(cp1.equals(cp3), is(true)); }
Source:
<code>public void testCellScannerStream() { Set<RowColumnValue> rowCols = new HashSet<>(); Set<RowColumnValue> empty = new HashSet<>(); rowCols.add(new RowColumnValue("r1", new Column("f1", "q1"), "v1")); rowCols.add(new RowColumnValue("r1", new Column("f2", "q3"), "v2")); rowCols.add(new RowColumnValue("r2", new Column("f1", "q1"), "v3")); rowCols.add(new RowColumnValue("r2", new Column("f1", "q2"), "v4")); rowCols.add(new RowColumnValue("r4", new Column("f2", "q5"), "v5")); CellScannerImpl cellScanStream = new CellScannerImpl(rowCols); rowCols.stream().filter(rcv -> rcv.getColumn().getsFamily().equals("f2")) .collect(Collectors.toSet()); cellScanStream.stream().filter(rcv -> rcv.getColumn().getsFamily().equals("f2")) <START> .collect(Collectors.toSet()); <END> Assert.assertNotEquals(empty, cellScanStream.stream().collect(Collectors.toSet())); Assert.assertEquals(rowCols, cellScanStream.stream().collect(Collectors.toSet())); Assert.assertEquals(rowCols.size(), cellScanStream.stream().count()); }</code><technical_language>is done sets created stream operations above</technical_language>

Target:
public void testCellScannerStream() { Set<RowColumnValue> rowCols = new HashSet<>(); Set<RowColumnValue> empty = new HashSet<>(); rowCols.add(new RowColumnValue("r1", new Column("f1", "q1"), "v1")); rowCols.add(new RowColumnValue("r1", new Column("f2", "q3"), "v2")); rowCols.add(new RowColumnValue("r2", new Column("f1", "q1"), "v3")); rowCols.add(new RowColumnValue("r2", new Column("f1", "q2"), "v4")); rowCols.add(new RowColumnValue("r4", new Column("f2", "q5"), "v5")); CellScannerImpl cellScanner = new CellScannerImpl(rowCols); Set<RowColumnValue> expected = rowCols.stream().filter(rcv -> rcv.getColumn().getsFamily().equals("f2")) .collect(Collectors.toSet()); Set<RowColumnValue> actualSubSet = cellScanner.stream().filter(rcv -> rcv.getColumn().getsFamily().equals("f2")) .collect(Collectors.toSet()); Assert.assertNotEquals(empty, actualSubSet); Assert.assertNotEquals(empty, cellScanner.stream().collect(Collectors.toSet())); Assert.assertEquals(rowCols, cellScanner.stream().collect(Collectors.toSet())); Assert.assertEquals(expected, actualSubSet); }