auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ProviderNetworkListModel() { setTitle(ConstantsManager.getInstance().getConstants().providerNetworksTitle()); setHashName("networks"); setDiscoverCommand(new UICommand(CMD_DISCOVER, this)); setComparator(new Comparator() { private Comparator<Network> netComparator = new Linq.NetworkByNameComparer(); @Override public int compare(Object o1, Object o2) { return netComparator.compare((Network) o1, (Network) o2); } }); }

Target:
public ProviderNetworkListModel() { setTitle(ConstantsManager.getInstance().getConstants().providerNetworksTitle()); setHashName("networks"); setDiscoverCommand(new UICommand(CMD_DISCOVER, this)); setComparator(new NameableComparator()); }
Source:
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { if (stack == null || stack.stackSize == 0) return null; ItemStack[] stacks = this.stacks; validateSlotIndex(slot, stacks); ItemStack existing = stacks[slot]; int limit = getStackLimit(slot, stack); if (existing != null) { if (!ItemHandlerHelper.canItemStacksStack(stack, existing)) return stack; limit -= existing.stackSize; } if (limit == 0) return stack; boolean reachedLimit = stack.stackSize > limit; if (!simulate) { if (existing == null) { stacks[slot] = reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.stackSize - limit) : stack; } else { existing.stackSize += reachedLimit ? limit : stack.stackSize; } onContentsChanged(slot); } return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : null; }

Target:
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { if (stack == null || stack.stackSize == 0) return null; validateSlotIndex(slot); ItemStack existing = this.stacks[slot]; int limit = getStackLimit(slot, stack); if (existing != null) { if (!ItemHandlerHelper.canItemStacksStack(stack, existing)) return stack; limit -= existing.stackSize; } if (limit <= 0) return stack; boolean reachedLimit = stack.stackSize > limit; if (!simulate) { if (existing == null) { this.stacks[slot] = reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack; } else { existing.stackSize += reachedLimit ? limit : stack.stackSize; } onContentsChanged(slot); } return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.stackSize - limit) : null; }
Source:
public Object[][] arbFracSensDataProvider() { final File wgsMetricsFile = new File(TEST_DIR, "test_Solexa-332667.wgs_metrics"); return new Object[][] { {0.90, wgsMetricsFile, .5, 100}, {0.77, wgsMetricsFile, .3, 100}, {0.29, wgsMetricsFile, .1, 100}, {0.08, wgsMetricsFile, .05, 100}, }; }

Target:
public Object[][] arbFracSensDataProvider() { final File wgsMetricsFile = new File(TEST_DIR, "test_Solexa-332667.wgs_metrics"); return new Object[][] { {0.90, wgsMetricsFile, 0.5, 100}, {0.77, wgsMetricsFile, 0.3, 100}, {0.29, wgsMetricsFile, 0.1, 100}, {0.08, wgsMetricsFile, 0.05, 100}, }; }
Source:
public Configuration removeConfiguration(String name) { Configuration conf = getConfiguration(name); if (conf != null && !conf.equals(containerConfiguration)) { configList.remove(conf); namedConfigurations.remove(name); } return conf; }

Target:
public Configuration removeConfiguration(String name) { Configuration conf = getConfiguration(name); if (conf != null && !conf.equals(containerConfiguration)) { configList.remove(conf); namedConfigurations.remove(name); } else if (conf != null && conf.equals(containerConfiguration)) { throw new IllegalArgumentException("Can't remove container configuration"); } return conf; }
Source:
protected void executeQueryCommand() { String suggestedDiskName = null; if (getParameters().getId() == null) { getQueryReturnValue().setReturnValue(suggestedDiskName); } else { VM vm = getDbFacade().getVmDao().get(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (vm != null) { updateDisksFromDb(vm); List<String> aliases = createDiskAliasesList(vm); int i = 0; do { i++; suggestedDiskName = ImagesHandler.getDefaultDiskAlias(vm.getName(), Integer.toString(vm.getDiskMapCount() + i)); } while(aliases.contains(suggestedDiskName)); } getQueryReturnValue().setReturnValue(suggestedDiskName); } }

Target:
protected void executeQueryCommand() { String suggestedDiskName = null; if (getParameters().getId() == null) { getQueryReturnValue().setReturnValue(suggestedDiskName); } else { VM vm = getDbFacade().getVmDao().get(getParameters().getId(), getUserID(), getParameters().isFiltered()); if (vm != null) { updateDisksFromDb(vm); suggestedDiskName = getSuggestedDiskName(vm); } getQueryReturnValue().setReturnValue(suggestedDiskName); } }
Source:
public Config buildConfig(Config defaultConfig, @Nullable String workspaceId) throws InfrastructureException { Subject subject = EnvironmentContext.getCurrent().getSubject(); if (oauthIdentityProvider == null) { LOG.debug("OAuth Provider is not configured, default config is used."); return defaultConfig; } if (subject == Subject.ANONYMOUS) { LOG.debug("OAuth Provider is not configured, default config is used."); return defaultConfig; } if (workspaceId == null) { LOG.debug( "OAuth Provider is configured and this request is not related to any workspace. OAuth token will be retrieved."); return personalizeConfig(defaultConfig); } Optional<RuntimeContext> context = workspaceRuntimeProvider.get().getRuntimeContext(workspaceId); if (!context.isPresent()) { LOG.debug( "Runtime Content for the specified workspace '%s' is not found. OAuth token will be retrieved."); return personalizeConfig(defaultConfig); } String workspaceOwnerId = context.map(c -> c.getIdentity().getOwnerId()).orElse(null); boolean isRuntimeOwner = subject.getUserId().equals(workspaceOwnerId); if (!isRuntimeOwner) { LOG.debug( "OAuth Provider is configured, but current subject is not runtime owner, default config is used." + "Subject user id: '{}'. Runtime owner id: '{}'", subject.getUserId(), workspaceOwnerId); return defaultConfig; } LOG.debug( "OAuth Provider is configured and current subject is runtime owner. OAuth token will be retrieved."); return personalizeConfig(defaultConfig); }

Target:
public Config buildConfig(Config defaultConfig, @Nullable String workspaceId) throws InfrastructureException { Subject subject = EnvironmentContext.getCurrent().getSubject(); if (oauthIdentityProvider == null) { LOG.debug("OAuth Provider is not configured, default config is used."); return defaultConfig; } if (subject == Subject.ANONYMOUS) { LOG.debug( "OAuth Provider is configured but default subject is anonymous, default config is used."); return defaultConfig; } if (workspaceId == null) { LOG.debug( "OAuth Provider is configured and this request is not related to any workspace. OAuth token will be retrieved."); return personalizeConfig(defaultConfig); } Optional<RuntimeContext> context = workspaceRuntimeProvider.get().getRuntimeContext(workspaceId); if (!context.isPresent()) { LOG.debug( "There is no runtime context for the specified workspace '%s'. It's the first workspace " + "related call, so context is personalized with OAuth token."); return personalizeConfig(defaultConfig); } String workspaceOwnerId = context.map(c -> c.getIdentity().getOwnerId()).orElse(null); boolean isRuntimeOwner = subject.getUserId().equals(workspaceOwnerId); if (!isRuntimeOwner) { LOG.debug( "OAuth Provider is configured, but current subject is not runtime owner, default config is used." + "Subject user id: '{}'. Runtime owner id: '{}'", subject.getUserId(), workspaceOwnerId); return defaultConfig; } LOG.debug( "OAuth Provider is configured and current subject is runtime owner. OAuth token will be retrieved."); return personalizeConfig(defaultConfig); }
Source:
public Response add(ClusterFeature feature) { validateParameters(feature); org.ovirt.engine.core.common.businessentities.AdditionalFeature featureEntity = map(feature, null); org.ovirt.engine.core.common.businessentities.Cluster cluster = BackendClusterFeatureHelper.getClusterEntity(this, asGuid(clusterId)); SupportedAdditionalClusterFeature supportedFeature = new SupportedAdditionalClusterFeature(); supportedFeature.setFeature(featureEntity); supportedFeature.setEnabled(true); supportedFeature.setClusterId(asGuid(clusterId)); cluster.getAddtionalFeaturesSupported().add(supportedFeature); ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(cluster); return performAction(ActionType.UpdateCluster, param); }

Target:
public Response add(ClusterFeature feature) { validateParameters(feature); org.ovirt.engine.core.common.businessentities.AdditionalFeature featureEntity = map(feature, null); org.ovirt.engine.core.common.businessentities.Cluster cluster = BackendClusterFeatureHelper.getClusterEntity(this, clusterId); SupportedAdditionalClusterFeature supportedFeature = new SupportedAdditionalClusterFeature(); supportedFeature.setFeature(featureEntity); supportedFeature.setEnabled(true); supportedFeature.setClusterId(clusterId); cluster.getAddtionalFeaturesSupported().add(supportedFeature); ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(cluster); return performCreate(ActionType.UpdateCluster, param, new ClusterFeatureIdResolver(clusterId, featureEntity.getId())); }
Source:
public PlanNode visitFilter(FilterNode node, Void context) { if (!(node.getSource() instanceof TableScanNode)) { return node; } TableScanNode oldTableScanNode = (TableScanNode) node.getSource(); TableHandle oldTableHandle = oldTableScanNode.getTable(); JdbcTableHandle oldConnectorTable = (JdbcTableHandle) oldTableHandle.getConnectorHandle(); RowExpression toTranslate = expressionOptimizer.optimize(node.getPredicate(), OPTIMIZED, session); toTranslate = logicalRowExpressions.convertToConjunctiveNormalForm(toTranslate); TranslatedExpression<JdbcSql> jdbcSqlTranslatedExpression = translateWith( toTranslate, rowExpressionToSqlTranslator, oldTableScanNode.getAssignments()); if (!oldTableHandle.getLayout().isPresent() || !jdbcSqlTranslatedExpression.getTranslated().isPresent()) { return node; } JdbcTableLayoutHandle oldTableLayoutHandle = (JdbcTableLayoutHandle) oldTableHandle.getLayout().get(); JdbcTableLayoutHandle newTableLayoutHandle = new JdbcTableLayoutHandle( oldConnectorTable, oldTableLayoutHandle.getTupleDomain(), jdbcSqlTranslatedExpression.getTranslated()); TableHandle tableHandle = new TableHandle( oldTableHandle.getConnectorId(), oldTableHandle.getConnectorHandle(), oldTableHandle.getTransaction(), Optional.of(newTableLayoutHandle)); TableScanNode newTableScanNode = new TableScanNode( idAllocator.getNextId(), tableHandle, oldTableScanNode.getOutputVariables(), oldTableScanNode.getAssignments(), oldTableScanNode.getCurrentConstraint(), oldTableScanNode.getEnforcedConstraint()); return new FilterNode(idAllocator.getNextId(), newTableScanNode, node.getPredicate()); }

Target:
public PlanNode visitFilter(FilterNode node, Void context) { if (!(node.getSource() instanceof TableScanNode)) { return node; } TableScanNode oldTableScanNode = (TableScanNode) node.getSource(); TableHandle oldTableHandle = oldTableScanNode.getTable(); JdbcTableHandle oldConnectorTable = (JdbcTableHandle) oldTableHandle.getConnectorHandle(); RowExpression predicate = expressionOptimizer.optimize(node.getPredicate(), OPTIMIZED, session); predicate = logicalRowExpressions.convertToConjunctiveNormalForm(predicate); TranslatedExpression<JdbcExpression> jdbcExpression = translateWith( predicate, jdbcFilterToSqlTranslator, oldTableScanNode.getAssignments()); if (!oldTableHandle.getLayout().isPresent() || !jdbcExpression.getTranslated().isPresent()) { return node; } JdbcTableLayoutHandle oldTableLayoutHandle = (JdbcTableLayoutHandle) oldTableHandle.getLayout().get(); JdbcTableLayoutHandle newTableLayoutHandle = new JdbcTableLayoutHandle( oldConnectorTable, oldTableLayoutHandle.getTupleDomain(), jdbcExpression.getTranslated()); TableHandle tableHandle = new TableHandle( oldTableHandle.getConnectorId(), oldTableHandle.getConnectorHandle(), oldTableHandle.getTransaction(), Optional.of(newTableLayoutHandle)); TableScanNode newTableScanNode = new TableScanNode( idAllocator.getNextId(), tableHandle, oldTableScanNode.getOutputVariables(), oldTableScanNode.getAssignments(), oldTableScanNode.getCurrentConstraint(), oldTableScanNode.getEnforcedConstraint()); return new FilterNode(idAllocator.getNextId(), newTableScanNode, node.getPredicate()); }
Source:
protected void modified(Map<String, Object> config) { config.keySet().stream().filter(k -> k.startsWith(CONFIG_DAYSET_PREFIX)).forEach(k -> { String[] setDefinition = config.get(k).toString().split(","); String[] setNameParts = k.split("-"); if (setDefinition.length > 0 && setNameParts.length > 1) { Set<DayOfWeek> dayset = new HashSet<>(); Stream.of(setDefinition).forEach(day -> { dayset.add(DayOfWeek.valueOf(day.toUpperCase())); }); daysets.put(setNameParts[1], dayset); } else { logger.warn("Erroneus dayset definition : {}", k, config.get(k)); } }); country = getValueAsString(config, CONFIG_COUNTRY); if (country == null && localeProvider != null) { country = localeProvider.getLocale().getCountry(); logger.debug("Using system default country '{}' ", country); } if (config.containsKey(CONFIG_REGION)) { countryParameters.add(getValueAsString(config, CONFIG_REGION)); } if (config.containsKey(CONFIG_CITY)) { countryParameters.add(getValueAsString(config, CONFIG_CITY)); } }

Target:
protected void modified(Map<String, Object> config) { config.entrySet().stream().filter(e -> e.getKey().startsWith(CONFIG_DAYSET_PREFIX)).forEach(e -> { String[] setDefinition = e.getValue().toString().toUpperCase().split(","); String[] setNameParts = e.getKey().split("-"); if (setDefinition.length > 0 && setNameParts.length > 1) { Set<DayOfWeek> dayset = new HashSet<>(); Stream.of(setDefinition).forEach(day -> { dayset.add(DayOfWeek.valueOf(day)); }); daysets.put(setNameParts[1], dayset); } else { logger.warn("Erroneous dayset definition : {}", e.getKey(), e.getValue()); } }); if (config.containsKey(CONFIG_COUNTRY)) { country = config.get(CONFIG_COUNTRY).toString(); } else { country = localeProvider.getLocale().getCountry(); logger.debug("Using system default country '{}' ", country); } if (config.containsKey(CONFIG_REGION)) { countryParameters.add(config.get(CONFIG_REGION).toString()); } if (config.containsKey(CONFIG_CITY)) { countryParameters.add(config.get(CONFIG_CITY).toString()); } }
Source:
public void userEventTriggered(final ChannelHandlerContext context, final Object event) throws Exception { if (event instanceof IdleStateEvent) { assert PING_TIMEOUT < this.apnsClient.idlePingIntervalMillis; log.trace("Sending ping due to inactivity."); final ByteBuf pingDataBuffer = context.alloc().ioBuffer(8, 8); pingDataBuffer.writeLong(this.nextPingId++); this.encoder().writePing(context, false, pingDataBuffer, context.newPromise()).addListener(new GenericFutureListener<ChannelFuture>() { @Override public void operationComplete(final ChannelFuture future) throws Exception { if (future.isSuccess()) { ApnsClientHandler.this.pingTimeoutFuture = future.channel().eventLoop().schedule(new Runnable() { @Override public void run() { log.debug("Closing channel due to ping timeout."); future.channel().close(); } }, PING_TIMEOUT, TimeUnit.SECONDS); } else { log.debug("Failed to write PING frame.", future.cause()); future.channel().close(); } } }); this.flush(context); } super.userEventTriggered(context, event); }

Target:
public void userEventTriggered(final ChannelHandlerContext context, final Object event) throws Exception { if (event instanceof IdleStateEvent) { log.trace("Sending ping due to inactivity."); final ByteBuf pingDataBuffer = context.alloc().ioBuffer(Long.SIZE, Long.SIZE); pingDataBuffer.writeLong(System.currentTimeMillis()); this.encoder().writePing(context, false, pingDataBuffer, context.newPromise()).addListener(new GenericFutureListener<ChannelFuture>() { @Override public void operationComplete(final ChannelFuture future) throws Exception { if (!future.isSuccess()) { log.debug("Failed to write PING frame.", future.cause()); future.channel().close(); } } }); this.pingTimeoutFuture = context.channel().eventLoop().schedule(new Runnable() { @Override public void run() { log.debug("Closing channel due to ping timeout."); context.channel().close(); } }, pingTimeoutMillis, TimeUnit.MILLISECONDS); this.flush(context); } super.userEventTriggered(context, event); }
Source:
private Service getCheWorkspaceService() throws IOException { ServiceList services = openShiftClient.services().inNamespace(this.cheOpenShiftProjectName).list(); Service service = services.getItems().stream() .filter(s -> s.getMetadata().getName().startsWith(CHE_OPENSHIFT_RESOURCES_PREFIX)) .findFirst().orElse(null); if (service == null) { LOG.error("No service with prefix " + CHE_OPENSHIFT_RESOURCES_PREFIX +" found"); throw new IOException("No service with prefix " + CHE_OPENSHIFT_RESOURCES_PREFIX +" found"); } return service; }

Target:
private Service getCheWorkspaceService() throws IOException { ServiceList services = openShiftClient.services().inNamespace(this.openShiftCheProjectName).list(); Service service = services.getItems().stream() .filter(s -> s.getMetadata().getName().startsWith(CHE_OPENSHIFT_RESOURCES_PREFIX)) .findFirst().orElse(null); if (service == null) { LOG.error("No service with prefix found", CHE_OPENSHIFT_RESOURCES_PREFIX); throw new IOException("No service with prefix " + CHE_OPENSHIFT_RESOURCES_PREFIX +" found"); } return service; }
Source:
public void showPage(Control page) { if (page.isDisposed() || page.getParent() != this) { return; } currentPage = page; page.setVisible(true); layout(true); Control[] children = getChildren(); for (Control element : children) { Control child = element; if (child != page && !child.isDisposed()) { child.setVisible(false); } } }

Target:
public void showPage(Control page) { if (page.isDisposed() || page.getParent() != this) { return; } currentPage = page; page.setVisible(true); layout(true); for (Control child : getChildren()) { if (child != page && !child.isDisposed()) { child.setVisible(false); } } }
Source:
void initializeLags() { Map<TopicPartition, Long> endOffsets; synchronized (kafkaConsumer) { endOffsets = kafkaConsumer.endOffsets(topicPartitionToSSP.keySet()); } if (endOffsets == null) { throw new SamzaException("Failed to fetch kafka consumer endoffsets for system " + systemName); } endOffsets.forEach((tp, offset) -> { SystemStreamPartition ssp = topicPartitionToSSP.get(tp); long startingOffset = nextOffsets.get(ssp); long initialLag = endOffsets.get(tp) - startingOffset; LOG.info("Initial lag for SSP is (end={}, startOffset={})", ssp, initialLag, endOffsets.get(tp), startingOffset); latestLags.put(ssp, initialLag); sink.setIsAtHighWatermark(ssp, initialLag == 0); }); refreshLagMetrics(); }

Target:
private void initializeLags() { Map<TopicPartition, Long> endOffsets; synchronized (kafkaConsumer) { endOffsets = kafkaConsumer.endOffsets(topicPartitionToSSP.keySet()); } if (endOffsets == null) { throw new SamzaException("Failed to fetch kafka consumer endoffsets for system " + systemName); } endOffsets.forEach((tp, offset) -> { SystemStreamPartition ssp = topicPartitionToSSP.get(tp); long startingOffset = nextOffsets.get(ssp); long initialLag = endOffsets.get(tp) - startingOffset; LOG.info("Initial lag for SSP is (end={}, startOffset={})", ssp, initialLag, endOffsets.get(tp), startingOffset); latestLags.put(ssp, initialLag); sink.setIsAtHighWatermark(ssp, initialLag == 0); }); refreshLagMetrics(); }
Source:
public void givenRedirectWithSmallBodyThenItRaisesNoAlert() { msg.getResponseHeader().setStatusCode(300); msg.getResponseHeader().setHeader("Location", URI); msg.setResponseBody(new byte[getAllowableBodySize()]); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), is(0)); }

Target:
public void givenRedirectWithSmallBodyThenItRaisesNoAlert() { msg.getResponseHeader().setStatusCode(HttpStatusCode.MOVED_PERMANENTLY); msg.getResponseHeader().setHeader(HttpHeader.LOCATION, URI); msg.setResponseBody(new byte[ALLOWABLE_BODY_SIZE]); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), is(0)); }
Source:
public StringType inputSource(String input){ String in = input.toLowerCase(); if(in.contains("extinput:btaudio".toLowerCase())){ return new StringType("btaudio"); } if(in.contains("extinput:tv".toLowerCase())){ return new StringType("tv"); } if(in.contains("extinput:hdmi?port=1".toLowerCase())){ return new StringType("hdmi1"); } if(in.contains("extinput:hdmi?port=2".toLowerCase())){ return new StringType("hdmi2"); } if(in.contains("extinput:hdmi?port=3".toLowerCase())){ return new StringType("hdmi3"); } if(in.contains("extinput:line".toLowerCase())){ return new StringType("analog"); } if(in.contains("storage:usb1".toLowerCase())){ return new StringType("usb"); } if(in.contains("dlna:music".toLowerCase())){ return new StringType("network"); } return new StringType(input); }

Target:
public StringType inputSource(String input) { String in = input.toLowerCase(); if (in.contains("extinput:btaudio".toLowerCase())) { return new StringType("btaudio"); } if (in.contains("extinput:tv".toLowerCase())) { return new StringType("tv"); } if (in.contains("extinput:hdmi?port=1".toLowerCase())) { return new StringType("hdmi1"); } if (in.contains("extinput:hdmi?port=2".toLowerCase())) { return new StringType("hdmi2"); } if (in.contains("extinput:hdmi?port=3".toLowerCase())) { return new StringType("hdmi3"); } if (in.contains("extinput:line".toLowerCase())) { return new StringType("analog"); } if (in.contains("storage:usb1".toLowerCase())) { return new StringType("usb"); } if (in.contains("dlna:music".toLowerCase())) { return new StringType("network"); } if (in.contains("cast:audio".toLowerCase())) { return new StringType("cast"); } return new StringType(input); }
Source:
public void addLhs(final T object, final Locatable interval) { if (object == null) { throw new IllegalArgumentException("null object"); } if (interval == null) { throw new IllegalArgumentException("null interval"); } final String seqId = interval.getContig(); IntervalTree<Set<T>> tree = this.cache.get(seqId); if (tree == null) { tree = new IntervalTree<>(); this.cache.put(seqId, tree); } final int start = interval.getStart() + this.lhsBuffer; final int end = interval.getEnd() - this.lhsBuffer; final Set<T> newValue = Collections.singleton(object); if (start <= end) { final Set<T> alreadyThere = tree.put(start, end, newValue); if (alreadyThere != null) { if( alreadyThere.size() == 1){ Set<T> mutableSet = new HashSet<>(2); mutableSet.addAll(alreadyThere); mutableSet.add(object); tree.put(start, end, mutableSet); } else { alreadyThere.add(object); tree.put(start, end, alreadyThere); } } } }

Target:
public void addLhs(final T object, final Locatable interval) { if (object == null) { throw new IllegalArgumentException("null object"); } if (interval == null) { throw new IllegalArgumentException("null interval"); } final String seqId = interval.getContig(); IntervalTree<Set<T>> tree = this.cache.get(seqId); if (tree == null) { tree = new IntervalTree<>(); this.cache.put(seqId, tree); } final int start = interval.getStart() + this.lhsBuffer; final int end = interval.getEnd() - this.lhsBuffer; if (start <= end) { tree.merge(start, end, Collections.singleton(object), mergeSetsAccountingForSingletons()); } }
Source:
public TestDescription createTestDescription() { final String name = String.format("%s(%s)", displayName, uniqueId); return new TestDescription(testClass, name, name, annotations.toArray(ANNOTATIONS_TYPE)); }

Target:
public ImmutableDescription createTestDescription() { final String name = String.format("%s(%s)", displayName, uniqueId); return new TestDescription(testClass, name, name, annotations.toArray(ANNOTATIONS_TYPE)); }
Source:
private boolean validateNoRunningJobs(Guid vdsId) { List<Step> steps = stepDao.getStartedStepsByStepSubjectEntity(new SubjectEntity(VdcObjectType.EXECUTION_HOST, vdsId)); if (!steps.isEmpty()) { getReturnValue().getValidationMessages().add(String.format("$jobs %1$s", steps.stream().map(s -> s.getDescription()).collect(Collectors.joining(System.lineSeparator())))); return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_HOST_WITH_RUNNING_JOBS); } return true; }

Target:
private boolean validateNoRunningJobs(Guid vdsId) { List<Step> steps = stepDao.getStartedStepsByStepSubjectEntity(new SubjectEntity(VdcObjectType.EXECUTION_HOST, vdsId)); if (!steps.isEmpty()) { return failValidation(EngineMessage.VDS_CANNOT_MAINTENANCE_HOST_WITH_RUNNING_JOBS, String.format("$jobs %1$s", steps.stream() .map(s -> s.getDescription()) .collect(Collectors.joining(System.lineSeparator())))); } return true; }
Source:
public Map<EndpointQualifier, NetworkStats> getNetworkStats() { if (unifiedConnectionManager != null) { return emptyMap(); } return connectionManagers.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getNetworkStats(), (a, b) -> b)); }

Target:
public Map<EndpointQualifier, NetworkStats> getNetworkStats() { if (unifiedConnectionManager != null) { return emptyMap(); } Map<EndpointQualifier, NetworkStats> stats = new HashMap<>(); for (Map.Entry<EndpointQualifier, TcpServerConnectionManager> entry : connectionManagers.entrySet()) { stats.put(entry.getKey(), entry.getValue().getNetworkStats()); } return stats; }
Source:
public void testBug() throws CoreException { boolean interrupted = Thread.interrupted(); if (interrupted) { fail("Thread was interrupted at start of test"); } workspace.run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) { ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell()); try { dialog.run(true, false, new TransferTestOperation()); } catch (InvocationTargetException e) { e.printStackTrace(); fail(e.getMessage()); } catch (InterruptedException e) { } } }, workspace.getRoot(), IResource.NONE, null); interrupted = Thread.interrupted(); if (interrupted) { fail("Thread was interrupted at end of test"); } }

Target:
public void testBug() throws CoreException { if (Thread.interrupted()) { fail("Thread was interrupted at start of test"); } workspace.run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) { ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell()); try { dialog.run(true, false, new TransferTestOperation()); } catch (InvocationTargetException e) { e.printStackTrace(); fail(e.getMessage()); } catch (InterruptedException e) { } } }, workspace.getRoot(), IResource.NONE, null); if (Thread.interrupted()) { fail("Thread was interrupted at end of test"); } }
Source:
protected String getAuthToken() { try { return authServiceClient.login(testUser.getEmail(), testUser.getPassword()); } catch (Exception ex) { throw new RuntimeException( format("Failed to access get token for user '%s'", testUser.getName())); } }

Target:
protected String getAuthToken() { try { return authServiceClient.login(email, password); } catch (Exception ex) { throw new RuntimeException(format("Failed to get access token for user '%s'", email)); } }
Source:
void receiveSeveral() { ImmutableList<OrderServed> eventsToEmit = ImmutableList.of( someOrderServedInTime(), someOrderServedInTime(), someOrderServedLate() ); eventsToEmit.forEach(restaurantContext::receivesEvent); ImmutableList<OrderServed> ordersServed = performanceTracker.ordersServed(); ImmutableList<OrderServedLate> ordersServedLate = performanceTracker.ordersServedLate(); assertThat(ordersServed).hasSize(eventsToEmit.size()); @SuppressWarnings("Guava") long ordersInTime = ordersServed .stream() .filter(not(this::isServedLate)) .count(); assertThat(ordersInTime).isEqualTo(2); assertThat(ordersServedLate).hasSize(1); }

Target:
void receiveSeveral() { ImmutableList<OrderServed> eventsToEmit = ImmutableList.of( someOrderServedInTime(), someOrderServedInTime(), someOrderServedLate() ); eventsToEmit.forEach(restaurantContext::receivesEvent); ImmutableList<OrderServed> ordersServed = performanceTracker.ordersServed(); ImmutableList<OrderServedLate> ordersServedLate = performanceTracker.ordersServedLate(); assertThat(ordersServed).hasSize(eventsToEmit.size()); long ordersInTime = ordersServed .stream() .filter(orderServed -> !performanceTracker.servedLate(orderServed)) .count(); assertThat(ordersInTime).isEqualTo(2); assertThat(ordersServedLate).hasSize(1); }
Source:
private void refresh() { try { String serviceId = this.config.getDiscovery().getServiceId(); List<String> listOfUrls = new ArrayList<>(); List<ServiceInstance> serviceInstances = this.instanceProvider .getConfigServerInstance(serviceId); for(int i=0;i< serviceInstances.size();i++) { ServiceInstance server = serviceInstances.get(i); String url = getHomePage(server); if (server.getMetadata().containsKey("password")) { String user = server.getMetadata().get("user"); user = user == null ? "user" : user; this.config.setUsername(user); String password = server.getMetadata().get("password"); this.config.setPassword(password); } if (server.getMetadata().containsKey("configPath")) { String path = server.getMetadata().get("configPath"); if (url.endsWith("/") && path.startsWith("/")) { url = url.substring(0, url.length() - 1); } url = url + path; } listOfUrls.add(url); } String[] uri = new String[listOfUrls.size()]; uri = listOfUrls.toArray(uri); this.config.setUri(uri); } catch (Exception ex) { if (config.isFailFast()) { throw ex; } else { logger.warn("Could not locate configserver via discovery", ex); } } }

Target:
private void refresh() { try { String serviceId = this.config.getDiscovery().getServiceId(); List<String> listOfUrls = new ArrayList<>(); List<ServiceInstance> serviceInstances = this.instanceProvider .getConfigServerInstances(serviceId); for (int i = 0; i < serviceInstances.size(); i++) { ServiceInstance server = serviceInstances.get(i); String url = getHomePage(server); if (server.getMetadata().containsKey("password")) { String user = server.getMetadata().get("user"); user = user == null ? "user" : user; this.config.setUsername(user); String password = server.getMetadata().get("password"); this.config.setPassword(password); } if (server.getMetadata().containsKey("configPath")) { String path = server.getMetadata().get("configPath"); if (url.endsWith("/") && path.startsWith("/")) { url = url.substring(0, url.length() - 1); } url = url + path; } listOfUrls.add(url); } String[] uri = new String[listOfUrls.size()]; uri = listOfUrls.toArray(uri); this.config.setUri(uri); } catch (Exception ex) { if (config.isFailFast()) { throw ex; } else { logger.warn("Could not locate configserver via discovery", ex); } } }
Source:
public static void initialize() throws Exception { Transport.register(TransportAmazonS3.PROTO_S3); loadBouncyCastle(); if (permitLongTests()) { logInfo("Long running testes are enabled."); } else { logWarn("Long running testes are not enabled."); } if (isTectConfigPresent()) { logInfo("Amazon S3 test configuration is present."); remoteCreate(); } else { logError( "Amazon S3 test configuration is missing, tests will not run."); } }

Target:
public static void initialize() throws Exception { Transport.register(TransportAmazonS3.PROTO_S3); loadBouncyCastle(); if (permitLongTests()) { logger.info("Long running tests are enabled."); } else { logger.warn("Long running tests are disabled."); } if (isTestConfigPresent()) { logger.info("Amazon S3 test configuration is present."); remoteCreate(); } else { logger.error( "Amazon S3 test configuration is missing, tests will not run."); } }
Source:
private String tableToString(Map<String, boolean[]> table) { StringBuilder tableStringBuilder = new StringBuilder(); table.forEach((key, value) -> { tableStringBuilder.append('{' + key + "={" + value[0] + ',' + value[1] + "}},"); }); String tableString = tableStringBuilder.toString(); if (!tableString.isEmpty()) { tableString = tableString.substring(0, tableString.length() - 1); } return tableString; }

Target:
private String tableToString(Map<String, boolean[]> table) { StringBuilder tableStringBuilder = new StringBuilder(); table.forEach((key, value) -> tableStringBuilder.append('{' + key + "={" + value[0] + ',' + value[1] + "}},")); String tableString = tableStringBuilder.toString(); if (!tableString.isEmpty()) { tableString = tableString.substring(0, tableString.length() - 1); } return tableString; }
Source:
public void hideExportProgressBar() { exportProgressBar.setValue(100); exportProgressBar.setIndeterminate(false); exportProgressBar.setVisible(false); }

Target:
public void hideExportProgressBar() { exportProgressBar.setVisible(false); }
Source:
public boolean matches(final Notification notification) { boolean match = false; Object notifier = notification.getNotifier(); EObject value = null; if (notifier instanceof Package) { if (Notification.REMOVE == notification.getEventType()) { if (notification.getOldValue() instanceof EObject) { value = (EObject) notification.getOldValue(); notificationMatch.put(value, new ResourceNotificationMatch((Package) notifier, value)); } } if (Notification.ADD == notification.getEventType()) { if (notification.getNewValue() instanceof EObject) { value = (EObject) notification.getNewValue(); ResourceNotificationMatch preMatch = notificationMatch.get(value); if (null != preMatch) { preMatch.setContainerTarget((Package) notifier); match = preMatch.isMatch(); } } } } else if (notifier instanceof Resource) { ResourceNotificationMatch matchNotification = null; if (Notification.REMOVE == notification.getEventType()) { if (notification.getOldValue() instanceof EObject) { value = (EObject) notification.getOldValue(); EObject rootContainer = EcoreUtil.getRootContainer(value, true); if (rootContainer instanceof Package) { matchNotification = new ResourceNotificationMatch((Resource) notifier, value); matchNotification.setContainerTarget((Package) rootContainer); notificationMatch.put(value, matchNotification); } } } if (Notification.ADD == notification.getEventType()) { if (notification.getNewValue() instanceof EObject) { value = (EObject) notification.getNewValue(); EObject rootContainer = EcoreUtil.getRootContainer(value, true); if (rootContainer instanceof Package) { matchNotification = new ResourceNotificationMatch((Package) rootContainer, value); matchNotification.setContainerTarget((Resource) notifier); notificationMatch.put(value, matchNotification); } } } match = null != matchNotification && matchNotification.isMatch(); } if (null == filterMatch && match) { filterMatch = notificationMatch.get(value); } return match; }

Target:
public boolean matches(final Notification notification) { boolean match = false; ResourceChangeMatcher matchNotification = handleNotification(notification); match = null != matchNotification && matchNotification.isMatch(); if (null == filterMatch && match) { filterMatch = matchNotification; } return match; }
Source:
private void initFabToSave(final ArrayList<Uri> uris) { clearFabActionItems(); floatingActionButton.getMainFab().setImageResource(R.drawable.ic_file_download_white_24dp); floatingActionButton .getMainFab() .setOnClickListener( v -> { if (uris != null && uris.size() > 0) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { File folder = new File(getCurrentMainFragment().getCurrentPath()); int result = mainActivityHelper.checkFolder(folder, MainActivity.this); if (result == MainActivityHelper.WRITABLE_OR_ON_SDCARD) { FileUtil.writeUriToStorage( MainActivity.this, uris, getContentResolver(), getCurrentMainFragment().getCurrentPath()); finish(); } else { operation = DataUtils.SAVE_FILE; urisToBeSaved = uris; mainActivityHelper.checkFolder(folder, MainActivity.this); } } else { FileUtil.writeUriToStorage( MainActivity.this, uris, getContentResolver(), getCurrentMainFragment().getCurrentPath()); Toast.makeText( MainActivity.this, getResources().getString(R.string.saving), Toast.LENGTH_LONG) .show(); finish(); } } else { Bundle extras = intent.getExtras(); String data = extras.getString(Intent.EXTRA_SUBJECT) + "\nURL: " + extras.getString(Intent.EXTRA_TEXT); String fileName = Long.toString(System.currentTimeMillis()); FileUtil.mktextfile(data, getCurrentMainFragment().getCurrentPath(), fileName); Toast.makeText( MainActivity.this, getResources().getString(R.string.saving) + " to " + getCurrentMainFragment().getCurrentPath(), Toast.LENGTH_LONG) .show(); finish(); } }); floatingActionButton.setVisibility(View.VISIBLE); }

Target:
private void initFabToSave(final ArrayList<Uri> uris) { clearFabActionItems(); floatingActionButton.getMainFab().setImageResource(R.drawable.ic_file_download_white_24dp); floatingActionButton .getMainFab() .setOnClickListener( v -> { if (uris != null && uris.size() > 0) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { File folder = new File(getCurrentMainFragment().getCurrentPath()); int result = mainActivityHelper.checkFolder(folder, MainActivity.this); if (result == MainActivityHelper.WRITABLE_OR_ON_SDCARD) { FileUtil.writeUriToStorage( MainActivity.this, uris, getContentResolver(), getCurrentMainFragment().getCurrentPath()); finish(); } else { operation = DataUtils.SAVE_FILE; urisToBeSaved = uris; mainActivityHelper.checkFolder(folder, MainActivity.this); } } else { FileUtil.writeUriToStorage( MainActivity.this, uris, getContentResolver(), getCurrentMainFragment().getCurrentPath()); Toast.makeText( MainActivity.this, getResources().getString(R.string.saving), Toast.LENGTH_LONG) .show(); finish(); } } else { Bundle extras = intent.getExtras(); String data = extras.getString(Intent.EXTRA_SUBJECT) + "\nURL: " + extras.getString(Intent.EXTRA_TEXT); String fileName = Long.toString(System.currentTimeMillis()); AppConfig.runInBackground( () -> FileUtil.mktextfile( data, getCurrentMainFragment().getCurrentPath(), fileName)); Toast.makeText( MainActivity.this, getResources().getString(R.string.saving) + " to " + getCurrentMainFragment().getCurrentPath(), Toast.LENGTH_LONG) .show(); finish(); } }); floatingActionButton.setVisibility(View.VISIBLE); }
Source:
public List<String> generateStatisticsForEachRecipient(String recipientEmail, Map<String, Integer> recipientResponses, FeedbackSessionResultsBundle bundle) { Assumption.assertTrue(hasAssignedWeights); List<String> recipientStats = new ArrayList<>(); DecimalFormat df = new DecimalFormat("0.00"); String recipientName = bundle.getNameForEmail(recipientEmail); String recipientTeam = bundle.getTeamNameForEmail(recipientEmail); double total = 0; double average = 0; int numOfResponsesForThisRecipient = 0; recipientStats.add(recipientTeam); recipientStats.add(recipientName); for (Map.Entry<String, Integer> countPerChoice : recipientResponses.entrySet()) { String choice = countPerChoice.getKey(); int responseCount = countPerChoice.getValue(); double weight = 0; recipientStats.add(Integer.toString(responseCount)); if ("Other".equals(choice)) { weight = mcqOtherWeight; } else { weight = mcqWeights.get(mcqChoices.indexOf(choice)); } total += responseCount * weight; numOfResponsesForThisRecipient += responseCount; } recipientStats.add(df.format(total)); average = numOfResponsesForThisRecipient == 0 ? 0 : total / numOfResponsesForThisRecipient; recipientStats.add(df.format(average)); return recipientStats; }

Target:
public List<String> generateStatisticsForEachRecipient(String recipientEmail, Map<String, Integer> recipientResponses, FeedbackSessionResultsBundle bundle) { Assumption.assertTrue("Weights should be enabled when calling the function", hasAssignedWeights); List<String> recipientStats = new ArrayList<>(); DecimalFormat df = new DecimalFormat("0.00"); String recipientName = bundle.getNameForEmail(recipientEmail); String recipientTeam = bundle.getTeamNameForEmail(recipientEmail); double total = 0; double average = 0; int numOfResponsesForThisRecipient = 0; recipientStats.add(recipientTeam); recipientStats.add(recipientName); for (Map.Entry<String, Integer> countPerChoice : recipientResponses.entrySet()) { String choice = countPerChoice.getKey(); int responseCount = countPerChoice.getValue(); double weight = 0; recipientStats.add(Integer.toString(responseCount)); if ("Other".equals(choice)) { weight = mcqOtherWeight; } else { weight = mcqWeights.get(mcqChoices.indexOf(choice)); } total += responseCount * weight; numOfResponsesForThisRecipient += responseCount; } recipientStats.add(df.format(total)); average = numOfResponsesForThisRecipient == 0 ? 0 : total / numOfResponsesForThisRecipient; recipientStats.add(df.format(average)); return recipientStats; }
Source:
public void registerAttributes(ManagementResourceRegistration registry) { for (AttributeDefinition attr : ATTRIBUTES) { if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { registry.registerReadWriteAttribute(attr, null, new ReloadRequiredWriteAttributeHandler(ATTRIBUTES)); } } BridgeControlHandler.INSTANCE.registerAttributes(registry); }

Target:
public void registerAttributes(ManagementResourceRegistration registry) { ReloadRequiredWriteAttributeHandler reloadRequiredWriteAttributeHandler = new ReloadRequiredWriteAttributeHandler(ATTRIBUTES); for (AttributeDefinition attr : ATTRIBUTES) { if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { registry.registerReadWriteAttribute(attr, null, reloadRequiredWriteAttributeHandler); } } BridgeControlHandler.INSTANCE.registerAttributes(registry); }
Source:
public List<Appointment> getAppointmentsByDate(long date) { DateTime dateTime = new DateTime(date); DateTime startOfDay = dateTime.withTime(0, 0, 0, 0); DateTime endOfDay = dateTime.withTime(23, 59, 59, 999); return appointmentDAO.getAppointmentByDate(startOfDay.getMillis(), endOfDay.getMillis()); }

Target:
public List<Appointment> getAppointmentsByDate(long date) { DateTime dateTime = new DateTime(date); DateTime startOfDay = dateTime.withTime(0, 0, 0, 0); DateTime endOfDay = dateTime.withTime(23, 59, 59, 999); return appointmentDAO.getAppointmentsByDate(startOfDay.getMillis(), endOfDay.getMillis()); }
Source:
private UserEntity getUserEntityById(final Long userId) throws EntityRetrievalException { UserEntity user = null; Query query = entityManager.createQuery( "from UserEntity where (NOT deleted = true) " + "AND (user_id = :userid) ", UserEntity.class); query.setParameter("userid", userId); List<UserEntity> result = query.getResultList(); if (result == null || result.size() == 0) { String msg = String.format(messageSource.getMessage(new DefaultMessageSourceResolvable("user.notFound"), LocaleContextHolder.getLocale())); throw new EntityRetrievalException(msg); } else if (result.size() > 1) { throw new EntityRetrievalException("Data error. Duplicate user id in database."); } if (result.size() == 0) { return null; } return result.get(0); }

Target:
private UserEntity getUserEntityById(final Long userId) throws EntityRetrievalException { UserEntity user = null; Query query = entityManager.createQuery( "from UserEntity where (NOT deleted = true) " + "AND (user_id = :userid) ", UserEntity.class); query.setParameter("userid", userId); List<UserEntity> result = query.getResultList(); if (result == null || result.size() == 0) { String msg = errorMessageUtil.getMessage("user.notFound"); throw new EntityRetrievalException(msg); } else if (result.size() > 1) { throw new EntityRetrievalException("Data error. Duplicate user id in database."); } if (result.size() == 0) { return null; } return result.get(0); }
Source:
protected Object getValue(String choice) throws IllegalArgumentException { return Enum.valueOf(this.type, choice); }

Target:
protected Object getValue(String choice) throws IllegalArgumentException { T value = this.values.get(choice.toLowerCase()); if (value == null) { throw new IllegalArgumentException("No enum constant " + this.type.getCanonicalName() + "." + choice); } return value; }
Source:
private void mockGetAllForImage() { Map<Boolean, VmTemplate> map = new HashMap<Boolean, VmTemplate>(); map.put(true, new VmTemplate()); doReturn(map).when(vmTemplateDao).getAllForImage(any(Guid.class)); }

Target:
private void mockGetAllForImage() { Map<Boolean, VmTemplate> map = Collections.singletonMap(true, new VmTemplate()); doReturn(map).when(vmTemplateDao).getAllForImage(any(Guid.class)); }
Source:
public DecoratableResourceAdapter(IndexDiffData indexDiffData, IResource resourceToWrap) throws IOException { super(resourceToWrap); this.indexDiffData = indexDiffData; trace = GitTraceLocation.DECORATION.isActive(); long start = 0; if (trace) { GitTraceLocation.getTrace().trace( GitTraceLocation.DECORATION.getLocation(), "Decorate " + resource.getFullPath()); start = System.currentTimeMillis(); } try { mapping = RepositoryMapping.getMapping(resource); if (mapping == null) { repository = null; return; } repository = mapping.getRepository(); if (repository == null) return; if (resource.getType() == IResource.PROJECT) { repositoryName = DecoratableResourceHelper .getRepositoryName(repository); branch = DecoratableResourceHelper.getShortBranch(repository); branchStatus = DecoratableResourceHelper.getBranchStatus(repository); } switch (resource.getType()) { case IResource.FILE: extractResourceProperties(); break; case IResource.PROJECT: tracked = true; case IResource.FOLDER: extractContainerProperties(); break; } } finally { if (trace) GitTraceLocation .getTrace() .trace(GitTraceLocation.DECORATION.getLocation(), "Decoration took " + (System.currentTimeMillis() - start) + " ms"); } }

Target:
public DecoratableResourceAdapter(IndexDiffData indexDiffData, IResource resourceToWrap) throws IOException { super(resourceToWrap); this.indexDiffData = indexDiffData; trace = GitTraceLocation.DECORATION.isActive(); long start = 0; if (trace) { GitTraceLocation.getTrace().trace( GitTraceLocation.DECORATION.getLocation(), "Decorate " + resource.getFullPath()); start = System.currentTimeMillis(); } try { mapping = RepositoryMapping.getMapping(resource); if (mapping == null) { repository = null; return; } repository = mapping.getRepository(); if (repository == null) return; switch (resource.getType()) { case IResource.FILE: extractResourceProperties(); break; case IResource.PROJECT: repositoryName = DecoratableResourceHelper .getRepositoryName(repository); branch = DecoratableResourceHelper.getShortBranch(repository); branchStatus = DecoratableResourceHelper.getBranchStatus(repository); tracked = true; case IResource.FOLDER: extractContainerProperties(); break; } } finally { if (trace) GitTraceLocation .getTrace() .trace(GitTraceLocation.DECORATION.getLocation(), "Decoration took " + (System.currentTimeMillis() - start) + " ms"); } }
Source:
@Nullable @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws BinaryObjectException { if (ldr == null) return deserialize(); GridBinaryMarshaller.USE_CACHE.set(Boolean.FALSE); return (T)reader(null, ldr, true).deserialize(); }

Target:
@Nullable @Override public <T> T deserialize(@Nullable ClassLoader ldr) throws BinaryObjectException { if (ldr == null) return deserialize(); GridBinaryMarshaller.USE_CACHE.set(Boolean.FALSE); try { return (T)reader(null, ldr, true).deserialize(); } finally { GridBinaryMarshaller.USE_CACHE.set(Boolean.TRUE); } }
Source:
public void testScopesAreCreated() { parseCode(TEST1); ASTBlock n = acu.findDescendantsOfType(ASTIfStatement.class).get(0) .getFirstDescendantOfType(ASTBlock.class); assertTrue(n.getScope() instanceof LocalScope); }

Target:
public void testScopesAreCreated() { parseCode(TEST1); ASTBlock n = acu.getFirstDescendantOfType(ASTIfStatement.class) .getFirstDescendantOfType(ASTBlock.class); assertTrue(n.getScope() instanceof LocalScope); }
Source:
public List<Node> getMembers() { List<Node> list = new ArrayList<>(); for (Address address : this.addresses) { Node node = this.factory.createNode(address); list.add(node); } return list; }

Target:
public List<Node> getMembers() { List<Node> list = new ArrayList<>(this.addresses.size()); for (Address address : this.addresses) { Node node = this.factory.createNode(address); list.add(node); } return list; }