auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateKeyWithResponseSnippets() { KeyClient keyClient = createClient(); Key key = keyClient.getKey("keyName"); key.getProperties().setExpires(OffsetDateTime.now().plusDays(60)); Key updatedKey = keyClient.updateKeyPropertiesWithResponse(key.getProperties(), new Context(key1, value1), KeyOperation.ENCRYPT, KeyOperation.DECRYPT).getValue(); System.out.printf("Key is getUpdated with name %s and id %s %n", updatedKey.getName(), updatedKey.getId()); END: com.azure.keyvault.keys.keyclient.updateKeyPropertiesWithResponse#KeyProperties-keyOperations-Context }

Target:
public void updateKeyWithResponseSnippets() { KeyClient keyClient = createClient(); Key key = keyClient.getKey("keyName"); key.getProperties().setExpires(OffsetDateTime.now().plusDays(60)); Key updatedKey = keyClient.updateKeyPropertiesWithResponse(key.getProperties(), new Context(key1, value1), KeyOperation.ENCRYPT, KeyOperation.DECRYPT).getValue(); System.out.printf("Key is updated with name %s and id %s %n", updatedKey.getName(), updatedKey.getId()); END: com.azure.keyvault.keys.keyclient.updateKeyPropertiesWithResponse#KeyProperties-keyOperations-Context }
Source:
public HashAggregator(GroupbyNode groupbyNode, Schema schema) throws IOException { hashTable = new TupleMap<>(context.getQueryContext().getInt(SessionVars.AGG_HASH_TABLE_SIZE)); List<Column> groupingKeyColumnList = new ArrayList<>(distinctGroupingKeyColumnSet); Column[] keyColumns = groupbyNode.getGroupingColumns(); Column col; for (Column keyColumn : keyColumns) { col = keyColumn; if (!distinctGroupingKeyColumnSet.contains(col)) { groupingKeyColumnList.add(col); } } Column[] groupingKeyColumns = groupingKeyColumnList.toArray(new Column[groupingKeyColumnList.size()]); if (groupbyNode.hasAggFunctions()) { aggFunctions = groupbyNode.getAggFunctions(); aggFunctionsNum = aggFunctions.size(); } else { aggFunctions = new ArrayList<>(); aggFunctionsNum = 0; } for (EvalNode aggFunction : aggFunctions) { aggFunction.bind(context.getEvalContext(), schema); } tupleSize = groupingKeyColumns.length + aggFunctionsNum; aggregatedTuple = new VTuple(groupingKeyColumns.length + aggFunctionsNum); innerKeyProjector = new KeyProjector(inSchema, groupingKeyColumns); }

Target:
public HashAggregator(GroupbyNode groupbyNode, Schema schema) throws IOException { hashTable = new TupleMap<>(context.getQueryContext().getInt(SessionVars.AGG_HASH_TABLE_SIZE)); List<Column> groupingKeyColumnList = new ArrayList<>(distinctGroupingKeyColumnSet); Column[] keyColumns = groupbyNode.getGroupingColumns(); for (Column keyColumn : keyColumns) { if (!distinctGroupingKeyColumnSet.contains(keyColumn)) { groupingKeyColumnList.add(keyColumn); } } Column[] groupingKeyColumns = groupingKeyColumnList.toArray(new Column[groupingKeyColumnList.size()]); if (groupbyNode.hasAggFunctions()) { aggFunctions = groupbyNode.getAggFunctions(); aggFunctionsNum = aggFunctions.size(); } else { aggFunctions = new ArrayList<>(); aggFunctionsNum = 0; } for (EvalNode aggFunction : aggFunctions) { aggFunction.bind(context.getEvalContext(), schema); } tupleSize = groupingKeyColumns.length + aggFunctionsNum; aggregatedTuple = new VTuple(groupingKeyColumns.length + aggFunctionsNum); innerKeyProjector = new KeyProjector(inSchema, groupingKeyColumns); }
Source:
public CheckAndMutateResult[] checkAndMutate(List<CheckAndMutate> checkAndMutates) throws IOException { List<CheckAndMutateResult> checkAndMutateResults = FutureUtils.get(table.checkAndMutateAll(checkAndMutates)); return checkAndMutateResults.toArray(new CheckAndMutateResult[0]); }

Target:
public List<CheckAndMutateResult> checkAndMutate(List<CheckAndMutate> checkAndMutates) throws IOException { return FutureUtils.get(table.checkAndMutateAll(checkAndMutates)); }
Source:
void disableCompactionForBlobStore(BlobStore store) { if (store.isStarted()) { storesToSkip.add(store); } }

Target:
boolean disableCompactionForBlobStore(BlobStore store) { storesDisabledCompaction.add(store); return true; }
Source:
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { if (!visible) { return; } FontRenderer fontrenderer = minecraft.fontRenderer; bindButtonTextures(minecraft); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int xOffset = texture.getX(); int yOffset = texture.getY(); int h = texture.getHeight(); int w = texture.getWidth(); boolean mouseOver = isMouseOver(); int buttonState = getButtonState(); drawTexturedModalRect(xPosition, yPosition, xOffset, yOffset + buttonState * h, width / 2, h); drawTexturedModalRect(xPosition + width / 2, yPosition, xOffset + w - width / 2, yOffset + buttonState * h, width / 2, h); mouseDragged(minecraft, mouseX, mouseY); drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, getTextColor(mouseOver)); }

Target:
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { if (!visible) { return; } FontRenderer fontrenderer = minecraft.fontRenderer; bindButtonTextures(minecraft); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int xOffset = texture.getX(); int yOffset = texture.getY(); int h = texture.getHeight(); int w = texture.getWidth(); boolean mouseOver = isMouseOver(); int hoverState = getHoverState(mouseOver); drawTexturedModalRect(xPosition, yPosition, xOffset, yOffset + hoverState * h, width / 2, h); drawTexturedModalRect(xPosition + width / 2, yPosition, xOffset + w - width / 2, yOffset + hoverState * h, width / 2, h); mouseDragged(minecraft, mouseX, mouseY); drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (h - 8) / 2, getTextColor(mouseOver)); }
Source:
private TestRunningOptions getTestRunningOptions(CommandRunnerParams params) { TestRunningOptions.Builder builder = TestRunningOptions.builder() .setCodeCoverageEnabled(isCodeCoverageEnabled) .setRunAllTests(isRunAllTests()) .setTestSelectorList(testSelectorOptions.getTestSelectorList()) .setShouldExplainTestSelectorList(testSelectorOptions.shouldExplain()) .setShufflingTests(isShufflingTests) .setPathToXmlTestOutput(Optional.ofNullable(pathToXmlTestOutput)) .setPathToJavaAgent(Optional.ofNullable(pathToJavaAgent)) .setCoverageReportFormats(EnumSet.copyOf(Arrays.asList(coverageReportFormats))) .setCoverageReportTitle(coverageReportTitle) .setEnvironmentOverrides(environmentOverrides); Optional<ImmutableList<String>> coverageIncludes = params.getBuckConfig().getOptionalListWithoutComments("test", "coverageIncludes", ','); Optional<ImmutableList<String>> coverageExcludes = params.getBuckConfig().getOptionalListWithoutComments("test", "coverageExcludes", ','); coverageIncludes.ifPresent( strings -> builder.setCoverageIncludes(strings.stream().collect(Collectors.joining(",")))); coverageExcludes.ifPresent( strings -> builder.setCoverageExcludes(strings.stream().collect(Collectors.joining(",")))); return builder.build(); }

Target:
private TestRunningOptions getTestRunningOptions(CommandRunnerParams params) { EnumSet<CoverageReportFormat> coverageFormats = EnumSet.noneOf(CoverageReportFormat.class); coverageFormats.addAll(Arrays.asList(this.coverageReportFormats)); TestRunningOptions.Builder builder = TestRunningOptions.builder() .setCodeCoverageEnabled(isCodeCoverageEnabled) .setRunAllTests(isRunAllTests()) .setTestSelectorList(testSelectorOptions.getTestSelectorList()) .setShouldExplainTestSelectorList(testSelectorOptions.shouldExplain()) .setShufflingTests(isShufflingTests) .setPathToXmlTestOutput(Optional.ofNullable(pathToXmlTestOutput)) .setPathToJavaAgent(Optional.ofNullable(pathToJavaAgent)) .setCoverageReportFormats(coverageFormats) .setCoverageReportTitle(coverageReportTitle) .setEnvironmentOverrides(environmentOverrides); Optional<ImmutableList<String>> coverageIncludes = params.getBuckConfig().getOptionalListWithoutComments("test", "coverageIncludes", ','); Optional<ImmutableList<String>> coverageExcludes = params.getBuckConfig().getOptionalListWithoutComments("test", "coverageExcludes", ','); coverageIncludes.ifPresent( strings -> builder.setCoverageIncludes(strings.stream().collect(Collectors.joining(",")))); coverageExcludes.ifPresent( strings -> builder.setCoverageExcludes(strings.stream().collect(Collectors.joining(",")))); return builder.build(); }
Source:
public void testDateComparisons() { statisticsAssertion.check("SELECT * FROM orders WHERE o_orderdate >= DATE '1993-10-01'", checks -> checks.estimate(OUTPUT_ROW_COUNT, defaultTolerance())); statisticsAssertion.check("SELECT * FROM orders WHERE o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH", checks -> checks.estimate(OUTPUT_ROW_COUNT, defaultTolerance())); }

Target:
public void testDateComparisons() { statisticsAssertion.check("SELECT * FROM orders WHERE o_orderdate >= DATE '1993-10-01'", checks -> checks.estimate(OUTPUT_ROW_COUNT, defaultTolerance())); statisticsAssertion.check("SELECT * FROM orders WHERE o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH", checks -> checks.estimate(OUTPUT_ROW_COUNT, defaultTolerance())); statisticsAssertion.check("SELECT * FROM orders WHERE o_orderdate >= DATE '1993-10-01' AND o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH", checks -> checks.estimate(OUTPUT_ROW_COUNT, defaultTolerance())); statisticsAssertion.check("SELECT * FROM orders WHERE o_orderdate >= DATE '1993-10-01' OR o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH", checks -> checks.estimate(OUTPUT_ROW_COUNT, defaultTolerance())); statisticsAssertion.check("SELECT * FROM orders WHERE NOT (o_orderdate >= DATE '1993-10-01' AND o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH)", checks -> checks.estimate(OUTPUT_ROW_COUNT, defaultTolerance())); }
Source:
public BlockFluidBase(Fluid fluid, Material material) { super(material); this.setTickRandomly(true); this.disableStats(); this.fluidName = fluid.getRegistryName(); this.density = fluid.density; this.temperature = fluid.temperature; this.maxScaledLight = fluid.luminosity; this.tickRate = fluid.viscosity / 200; this.densityDir = fluid.density > 0 ? -1 : 1; fluid.setBlock(this); this.definedFluid = fluid; displacements.putAll(defaultDisplacements); this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, 0)); }

Target:
public BlockFluidBase(Fluid fluid, Material material) { super(material); Preconditions.checkNotNull(fluid.getRegistryName(), "Cannot create Block for Fluid with null registry name %s", fluid); this.setTickRandomly(true); this.disableStats(); this.fluidName = fluid.getRegistryName(); this.density = fluid.density; this.temperature = fluid.temperature; this.maxScaledLight = fluid.luminosity; this.tickRate = fluid.viscosity / 200; this.densityDir = fluid.density > 0 ? -1 : 1; fluid.setBlock(this); this.definedFluid = fluid; displacements.putAll(defaultDisplacements); this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, 0)); }
Source:
public Object[] getElements() { ArrayList<Event> events = new ArrayList<>(); if (protocols.size() > 0) { addAnyEvent(events, protocols.get(0)); } ; return events.toArray(); }

Target:
public Object[] getElements() { ArrayList<Event> events = new ArrayList<>(); if (protocols.size() > 0) { events.add(protocols.get(0).getAnyReceiveEvent()); } return events.toArray(); }
Source:
protected void setEcsNetworkConfiguration(final EcsClientConfig clientConfig, final RunTaskRequest request) { if (!clientConfig.getSubnets().isEmpty()) { request.withNetworkConfiguration(new NetworkConfiguration().withAwsvpcConfiguration( new AwsVpcConfiguration() .withSubnets(clientConfig.getSubnets()) .withAssignPublicIp(AssignPublicIp.ENABLED) )); } }

Target:
protected void setEcsNetworkConfiguration(final EcsClientConfig clientConfig, final RunTaskRequest request) { if (clientConfig.getSubnets().isPresent()) { request.withNetworkConfiguration(new NetworkConfiguration().withAwsvpcConfiguration( new AwsVpcConfiguration() .withSubnets(clientConfig.getSubnets().get()) .withAssignPublicIp(clientConfig.isAssignPublicIp() ? AssignPublicIp.ENABLED : AssignPublicIp.DISABLED) )); } }
Source:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (receiver instanceof Shell) { Shell shell = (Shell) receiver; if (shell.isDisposed()) { return false; } Object shellData = shell.getData(); if (shellData instanceof FilteredPreferenceDialog) { FilteredPreferenceDialog propertyDialog = (FilteredPreferenceDialog) shellData; IPreferencePage currentPage = propertyDialog.getCurrentPage(); if (currentPage != null) { return currentPage.getClass().getName().equals(expectedValue); } } } return true; }

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (receiver instanceof Shell) { Shell shell = (Shell) receiver; if (shell.isDisposed()) { return false; } Object shellData = shell.getData(); if (shellData instanceof FilteredPreferenceDialog) { FilteredPreferenceDialog propertyDialog = (FilteredPreferenceDialog) shellData; IPreferencePage currentPage = propertyDialog.getCurrentPage(); if (currentPage != null) { return currentPage.getClass().getName().equals(expectedValue); } } } return false; }
Source:
public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; if (resources.length > 0) { if (paths != null) { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().setPaths(paths).call(); } } else { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().call(); } } } }

Target:
public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; if (resources == null) { throw new CoreException(new Status(IStatus.ERROR, Activator .getPluginId(), CoreText.OperationAlreadyExecuted)); } if (resources.length > 0) { if (paths != null) { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().setPaths(paths).call(); } } else { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().call(); } } } }
Source:
public SchedulerService(WorkflowInstanceExecutor workflowInstanceExecutor, Environment env) { int dbPoolSize = env.getProperty("nflow.db.max_pool_size", Integer.class); int dispatcherCount = workflowInstanceExecutor.getThreadCount(); int threadPoolSize = Math.max(dbPoolSize - dispatcherCount, 2); logger.info("Initializing REST API thread pool size to {}", threadPoolSize); this.scheduler = Schedulers.fromExecutor(Executors.newFixedThreadPool(threadPoolSize)); }

Target:
public SchedulerService(WorkflowInstanceExecutor workflowInstanceExecutor, Environment env) { int dbPoolSize = env.getProperty("nflow.db.max_pool_size", Integer.class); int dispatcherCount = workflowInstanceExecutor.getThreadCount(); int threadPoolSize = max(dbPoolSize - dispatcherCount, 2); logger.info("Initializing REST API thread pool size to {}", threadPoolSize); this.scheduler = fromExecutor(Executors.newFixedThreadPool(threadPoolSize)); }
Source:
private boolean areNewerMediaFilesAvailable(DriveListItem item) { String mediaDirName = FileUtils.constructMediaPath(item.getName()); try { List<com.google.api.services.drive.model.File> mediaFileList; try { mediaFileList = getMediaFiles(item); } catch (MultipleFoldersFoundException exception) { return false; } if (mediaFileList != null) { for (com.google.api.services.drive.model.File mediaFile : mediaFileList) { File localMediaFile = new File(new StoragePathProvider().getDirPath(StorageSubdirectory.FORMS) + File.separator + mediaDirName + File.separator + mediaFile.getName()); if (!localMediaFile.exists()) { return true; } else { Long lastModifiedLocal = localMediaFile.lastModified(); Long lastModifiedServer = mediaFile.getModifiedTime().getValue(); if (lastModifiedServer > lastModifiedLocal) { return true; } } } } } catch (Exception e) { Timber.e(e); } return false; }

Target:
private boolean areNewerMediaFilesAvailable(DriveListItem item) { String mediaDirName = FileUtils.constructMediaPath(item.getName()); try { List<com.google.api.services.drive.model.File> mediaFileList; try { mediaFileList = getMediaFiles(item); } catch (MultipleFoldersFoundException exception) { return false; } if (mediaFileList != null) { for (com.google.api.services.drive.model.File mediaFile : mediaFileList) { File localMediaFile = new File(storagePathProvider.getDirPath(StorageSubdirectory.FORMS) + File.separator + mediaDirName + File.separator + mediaFile.getName()); if (!localMediaFile.exists()) { return true; } else { Long lastModifiedLocal = localMediaFile.lastModified(); Long lastModifiedServer = mediaFile.getModifiedTime().getValue(); if (lastModifiedServer > lastModifiedLocal) { return true; } } } } } catch (Exception e) { Timber.w(e); } return false; }
Source:
private void validateOrders(HashSet<Order> unboughtOrders, HashSet<Order> unsoldOrders, CumulativeOrder cumulativeBuyOrder, CumulativeOrder cumulativeSellOrder, double matchingPrice) { HashSet<Order> validBuyOrders = new HashSet<Order>(); HashSet<Order> validSellOrders = new HashSet<Order>(); for (Order o : unboughtOrders) { if (o.isMarketOrder() || o.getPrice() >= matchingPrice) { validBuyOrders.add(o); } } for (Order o : unsoldOrders) { if (o.isMarketOrder() || o.getPrice() <= matchingPrice) { validSellOrders.add(o); } } if (cumulativeBuyOrder != null && cumulativeBuyOrder.getCumulativePrice() >= matchingPrice) { validBuyOrders.addAll(cumulativeBuyOrder.getOrders()); } if (cumulativeSellOrder != null && cumulativeSellOrder.getCumulativePrice() <= matchingPrice) { validSellOrders.addAll(cumulativeSellOrder.getOrders()); } unboughtOrders.clear(); unboughtOrders.addAll(validBuyOrders); unsoldOrders.clear(); unsoldOrders.addAll(validSellOrders); }

Target:
private void validateOrders(HashSet<Order> unboughtOrders, HashSet<Order> unsoldOrders, CumulativeOrder cumulativeBuyOrder, CumulativeOrder cumulativeSellOrder, double matchingPrice) { HashSet<Order> validBuyOrders = new HashSet<Order>(); HashSet<Order> validSellOrders = new HashSet<Order>(); validBuyOrders = addValidBuyOrders(unboughtOrders, validBuyOrders); validSellOrders = addValidSellOrders(unsoldOrders, validSellOrders); if (cumulativeBuyOrder != null && cumulativeBuyOrder.getCumulativePrice() >= matchingPrice) { validBuyOrders.addAll(cumulativeBuyOrder.getOrders()); } if (cumulativeSellOrder != null && cumulativeSellOrder.getCumulativePrice() <= matchingPrice) { validSellOrders.addAll(cumulativeSellOrder.getOrders()); } unboughtOrders.clear(); unboughtOrders.addAll(validBuyOrders); unsoldOrders.clear(); unsoldOrders.addAll(validSellOrders); }
Source:
private void whole(final int type, final long pos, final long sz) throws IOException { IObjectChecker checker=(objCheck==null)?null:objCheck.checkerFor(type); if (checker != null) { ByteArrayOutputStream destinationForInflatedObjectData=new ByteArrayOutputStream((int) sz); updateTempObjectIdWithDigestForPackedObject(type, sz, destinationForInflatedObjectData); byte[] data = destinationForInflatedObjectData.toByteArray(); try { checker.check(data); } catch (CorruptObjectException e) { throw new IOException(MessageFormat.format(JGitText.get().invalidObject , Constants.typeString(type) , tempObjectId.name() , e.getMessage())); } verifySafeObject(tempObjectId, type, data); } else { updateTempObjectIdWithDigestForPackedObject(type, sz, NullOutputStream.INSTANCE); } final int crc32 = (int) crc.getValue(); addObjectAndTrack(new PackedObjectInfo(pos, crc32, tempObjectId)); }

Target:
private void whole(final int type, final long pos, final long sz) throws IOException { objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(sz)); objectDigest.update((byte) 0); boolean checkContentLater = false; if (type == Constants.OBJ_BLOB && sz >= streamFileThreshold) { InputStream inf = inflate(Source.INPUT, sz); long cnt = 0; while (cnt < sz) { int r = inf.read(readBuffer); if (r <= 0) break; objectDigest.update(readBuffer, 0, r); cnt += r; } inf.close(); tempObjectId.fromRaw(objectDigest.digest(), 0); checkContentLater = readCurs.has(tempObjectId); } else { final byte[] data = inflateAndReturn(Source.INPUT, sz); objectDigest.update(data); tempObjectId.fromRaw(objectDigest.digest(), 0); verifySafeObject(tempObjectId, type, data); } final int crc32 = (int) crc.getValue(); PackedObjectInfo obj = new PackedObjectInfo(pos, crc32, tempObjectId); addObjectAndTrack(obj); if (checkContentLater) deferredCheckContent.add(obj); }
Source:
void test_for_valid_value() { IntStream.range(1, 20).forEach(i -> assertTrue(validator.isValid(UUID.randomUUID().toString(), null))); }

Target:
void test_for_valid_value() { assertTrue(validator.isValid(UUID.randomUUID().toString(), null)); }
Source:
public void process(final Exchange exchange) throws Exception { final Endpoint endpoint = getEndpoint(); final CamelContext camelContext = endpoint.getCamelContext(); final Message in = exchange.getIn(); final Map<String, Object> headers = in.getHeaders(); final String expandedUri = baseTemplate.expand(headers); final URI uri = URI.create(expandedUri); final String host = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null).toString(); final String basePath = uri.getPath(); final String path = pathTemplate.expand(headers); producer = restProducerFactory.createProducer(camelContext, host, method, basePath, path, null, null, null, null); ServiceHelper.startService(producer); producer.process(exchange); }

Target:
public void process(final Exchange exchange) throws Exception { final Endpoint endpoint = getEndpoint(); final CamelContext camelContext = endpoint.getCamelContext(); final Message in = exchange.getIn(); final Map<String, Object> headers = in.getHeaders(); final String expandedUri = baseTemplate.expand(headers); final URI uri = URI.create(expandedUri); final String host = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null).toString(); final String basePath = uri.getPath(); final String path = pathTemplate.expand(headers); Producer answer = producerRef.get(); if (answer == null) { answer = restProducerFactory.createProducer(camelContext, host, method, basePath, path, null, null, null, null); if (producerRef.compareAndSet(null, answer)) { ServiceHelper.startService(answer); } } answer.process(exchange); }
Source:
public void init(final Command callback) { libraryService.call((OrganizationalUnitRepositoryInfo info) -> { if (info != null) { LibraryToolbarPresenter.this.info = info; view.init(LibraryToolbarPresenter.this); setupRepositories(info); selectedRepository = info.getSelectedRepository(); selectedBranch = info.getSelectedRepository().getDefaultBranch(); setBranchSelectorVisibility(); setRepositorySelectorVisibility(); final ProjectContextChangeEvent event = new ProjectContextChangeEvent(info.getSelectedOrganizationalUnit()); projectContextChangeEvent.fire(event); callback.execute(); } }).getDefaultOrganizationalUnitRepositoryInfo(); }

Target:
public void init(final Command callback) { libraryService.call((OrganizationalUnitRepositoryInfo info) -> { LibraryToolbarPresenter.this.info = info; if (info != null) { view.init(LibraryToolbarPresenter.this); setupRepositories(info); selectedRepository = info.getSelectedRepository(); selectedBranch = info.getSelectedRepository().getDefaultBranch(); final ProjectContextChangeEvent event = new ProjectContextChangeEvent(info.getSelectedOrganizationalUnit()); projectContextChangeEvent.fire(event); callback.execute(); } else { notificationEvent.fire(new NotificationEvent(view.getNotEnoughPermissionsToAccessLibraryMessage(), NotificationEvent.NotificationType.ERROR)); } setBranchSelectorVisibility(); setRepositorySelectorVisibility(); }).getDefaultOrganizationalUnitRepositoryInfo(); }
Source:
public static Collection<Collection<ShardIndexInfo>> getShardsByDaysBuckets(Table tableInfo, Collection<ShardIndexInfo> shards, TemporalFunction temporalFunction) { if (shards.size() == 0) { return ImmutableList.of(); } if (!tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return ImmutableList.of(shards); } if (tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return Multimaps.index(shards, shard -> shard.getBucketNumber().getAsInt()).asMap().values(); } ImmutableMultimap.Builder<Long, ShardIndexInfo> shardsByDaysBuilder = ImmutableMultimap.builder(); shards.stream() .filter(shard -> shard.getTemporalRange().isPresent()) .forEach(shard -> { long day = temporalFunction.getDayFromRange(shard.getTemporalRange().get()); shardsByDaysBuilder.put(day, shard); }); Collection<Collection<ShardIndexInfo>> byDays = shardsByDaysBuilder.build().asMap().values(); if (!tableInfo.getBucketCount().isPresent()) { return byDays; } ImmutableList.Builder<Collection<ShardIndexInfo>> sets = ImmutableList.builder(); for (Collection<ShardIndexInfo> s : byDays) { sets.addAll(Multimaps.index(s, ShardIndexInfo::getBucketNumber).asMap().values()); } return sets.build(); }

Target:
public static Collection<Collection<ShardIndexInfo>> getShardsByDaysBuckets(Table tableInfo, Collection<ShardIndexInfo> shards, TemporalFunction temporalFunction) { if (shards.isEmpty()) { return ImmutableList.of(); } if (!tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return ImmutableList.of(shards); } if (tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return Multimaps.index(shards, shard -> shard.getBucketNumber().getAsInt()).asMap().values(); } ImmutableMultimap.Builder<Long, ShardIndexInfo> shardsByDaysBuilder = ImmutableMultimap.builder(); shards.stream() .filter(shard -> shard.getTemporalRange().isPresent()) .forEach(shard -> { long day = temporalFunction.getDayFromRange(shard.getTemporalRange().get()); shardsByDaysBuilder.put(day, shard); }); Collection<Collection<ShardIndexInfo>> byDays = shardsByDaysBuilder.build().asMap().values(); if (!tableInfo.getBucketCount().isPresent()) { return byDays; } ImmutableList.Builder<Collection<ShardIndexInfo>> sets = ImmutableList.builder(); for (Collection<ShardIndexInfo> s : byDays) { sets.addAll(Multimaps.index(s, ShardIndexInfo::getBucketNumber).asMap().values()); } return sets.build(); }
Source:
private MachineConfigImpl queuePeekOrFail(String workspaceId) throws ConflictException, ServerException { acquireReadLock(workspaceId); try { ensurePreDestroyIsNotExecuted(); final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue == null) { throw new ConflictException(format("Workspace '%s' start interrupted. " + "Workspace was stopped before all its machines were started", workspaceId)); } return queue.peek(); } finally { releaseReadLock(workspaceId); } }

Target:
private MachineConfigImpl queuePeekOrFail(String workspaceId) throws ConflictException, ServerException { acquireReadLock(workspaceId); try { ensurePreDestroyIsNotExecuted(); final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue == null) { throw new ConflictException( format("Workspace '%s' start interrupted. Workspace was stopped before all its machines were started", workspaceId)); } return queue.peek(); } finally { releaseReadLock(workspaceId); } }
Source:
private static List<Entry<Cell, byte[]>> postFilterEmptyValues( Iterator<Entry<Cell, byte[]>> mergeIterators) { List<Entry<Cell, byte[]>> mergedWritesWithoutEmptyValues = new ArrayList<>(); Predicate<Entry<Cell, byte[]>> nonEmptyValuePredicate = Predicates.compose(Predicates.not(Value.IS_EMPTY), MapEntries.getValueFunction()); while (mergeIterators.hasNext()) { Entry<Cell, byte[]> next = mergeIterators.next(); if (nonEmptyValuePredicate.apply(next)) { mergedWritesWithoutEmptyValues.add(next); } else { getMeter(AtlasDbMetricNames.CellFilterMetrics.EMPTY_VALUE).mark(); } } return mergedWritesWithoutEmptyValues; }

Target:
private static List<Entry<Cell, byte[]>> postFilterEmptyValues( Iterator<Entry<Cell, byte[]>> mergeIterators) { List<Entry<Cell, byte[]>> mergedWritesWithoutEmptyValues = new ArrayList<>(); Predicate<Entry<Cell, byte[]>> nonEmptyValuePredicate = Predicates.compose(Predicates.not(Value.IS_EMPTY), MapEntries.getValueFunction()); long numEmptyValues = 0; while (mergeIterators.hasNext()) { Entry<Cell, byte[]> next = mergeIterators.next(); if (nonEmptyValuePredicate.apply(next)) { mergedWritesWithoutEmptyValues.add(next); } else { numEmptyValues++; } } getMeter(AtlasDbMetricNames.CellFilterMetrics.EMPTY_VALUE).mark(numEmptyValues); return mergedWritesWithoutEmptyValues; }
Source:
public boolean canEditPipelineGroup(String groupName, Username username, HttpLocalizedOperationResult result) { CruiseConfig cruiseConfig = getCurrentConfig(); if((isValidGroup(groupName, cruiseConfig, result) && isAdminOfGroup(groupName, username, result)) == true) { return true; } return false; }

Target:
public boolean canEditPipelineGroup(String groupName, Username username, HttpLocalizedOperationResult result) { CruiseConfig cruiseConfig = getCurrentConfig(); return (isValidGroup(groupName, cruiseConfig, result) && isAdminOfGroup(groupName, username, result)); }
Source:
public void annotationShouldWorkWithRange() { DateRangeRandomizerTest.TestData data = null; for(int x=0; x < 10; x++) { data = new EnhancedRandomBuilder().build().nextObject(DateRangeRandomizerTest.TestData.class); System.out.println(data.getDate().toString()); then(data.getDate().getTime()).isBetween( 1452384000000L, 1454112000000L ); } }

Target:
public void annotationShouldWorkWithRange() throws Exception { DateRangeRandomizerTest.TestData data = null; for(int x=0; x < 10; x++) { data = EnhancedRandom.random(DateRangeRandomizerTest.TestData.class); then(data.getDate().getTime()).isBetween( LocalDate.parse("2016-01-10").atStartOfDay().toEpochSecond(ZoneOffset.UTC)*1000, LocalDate.parse("2016-01-30").atStartOfDay().toEpochSecond(ZoneOffset.UTC)*1000 ); } }
Source:
public void dispose() { for (DisposeListener l : dispseListeners) { Event e = new Event(); e.widget = getControl(); l.widgetDisposed(new DisposeEvent(e)); } dispseListeners.clear(); part = null; super.dispose(); }

Target:
public void dispose() { for (DisposeListener l : disposeListeners) { Event e = new Event(); e.widget = getControl(); SafeRunnable runnable = new SafeRunnable() { @Override public void run() throws Exception { l.widgetDisposed(new DisposeEvent(e)); } }; SafeRunnable.run(runnable); } disposeListeners.clear(); part = null; super.dispose(); }
Source:
private static JsonObject pull(final String title) throws Exception { return Json.createObjectBuilder() .add("number", new Random().nextInt()) .add("state", "open") .add("title", title) .build(); }

Target:
private static JsonObject pull(final String title) throws Exception { return Json.createObjectBuilder() .add("number", new Random().nextInt()) .add("state", Issue.OPEN_STATE) .add("title", title) .build(); }
Source:
public int compare(Annotation o1, Annotation o2) { Class<? extends Annotation> c1 = o1.annotationType(); Class<? extends Annotation> c2 = o2.annotationType(); Method priority1 = getPriorityMethod(c1); Method priority2 = getPriorityMethod(c2); int p1 = getPriorityValue(priority1, o1, c1); int p2 = getPriorityValue(priority2, o2, c2); if (p2 > p1) { return -1; } else if (p2 < p1) { return 1; } else { return 0; } }

Target:
public int compare(Annotation o1, Annotation o2) { Class<? extends Annotation> c1 = o1.annotationType(); Class<? extends Annotation> c2 = o2.annotationType(); Method priority1 = getPriorityMethod(c1); Method priority2 = getPriorityMethod(c2); int p1 = getPriorityValue(priority1, o1, c1); int p2 = getPriorityValue(priority2, o2, c2); return signum(p1 - p2); }
Source:
public TmfConstantTransform(long offset) { fOffset = Long.valueOf(offset); }

Target:
public TmfConstantTransform(long offset) { fOffset = offset; }
Source:
protected void executeCommand() { entity = getGlusterHook(); addCustomValue(GlusterConstants.HOOK_NAME, entity.getName()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS server : getServersInCluster()) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue; returnValue = runVdsCommand( VDSCommandType.RemoveGlusterHook, new GlusterHookVDSParameters(server.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName() )); return new Pair<VDS, VDSReturnValue>(server, returnValue); } }); } setSucceeded(true); if (!taskList.isEmpty()) { List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (!retValue.getSucceeded() ) { errors.add(retValue.getVdsError().getMessage()); } } } else { setSucceeded(false); } if (errors.size() > 0) { setSucceeded(false); errorType = AuditLogType.GLUSTER_HOOK_REMOVE_FAILED; handleVdsErrors(getAuditLogTypeValue(), errors); addCustomValue(GlusterConstants.FAILURE_MESSAGE , StringUtils.join(errors, SystemUtils.LINE_SEPARATOR)); } if (getSucceeded()) { entity.removeMissingConflict(); getGlusterHooksDao().remove(entity.getId()); } }

Target:
protected void executeCommand() { entity = getGlusterHook(); addCustomValue(GlusterConstants.HOOK_NAME, entity.getName()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS server : getServersInCluster()) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue; returnValue = runVdsCommand( VDSCommandType.RemoveGlusterHook, new GlusterHookVDSParameters(server.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName() )); return new Pair<VDS, VDSReturnValue>(server, returnValue); } }); } if (!taskList.isEmpty()) { List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (!retValue.getSucceeded() ) { errors.add(retValue.getVdsError().getMessage()); } } } if (errors.size() > 0) { setSucceeded(false); errorType = AuditLogType.GLUSTER_HOOK_REMOVE_FAILED; handleVdsErrors(getAuditLogTypeValue(), errors); addCustomValue(GlusterConstants.FAILURE_MESSAGE , StringUtils.join(errors, SystemUtils.LINE_SEPARATOR)); } if (getSucceeded()) { entity.removeMissingConflict(); getGlusterHooksDao().remove(entity.getId()); } else { setSucceeded(false); } }
Source:
public void setExecutionAudit(BiConsumer<RequestData, Authentication> executionAudit) { this.executionAudit = executionAudit; }

Target:
void setExecutionAudit(BiConsumer<RequestData, Authentication> executionAudit) { this.executionAudit = executionAudit; }
Source:
private void updateDescription(GameInfo item) { String mainWorldGenerator = item.getManifest() .getWorldInfo(TerasologyConstants.MAIN_WORLD) .getWorldGenerator() .getObjectName() .toString(); String modules = item.getManifest() .getModules() .stream() .map(NameVersion::getName) .map(Name::toString) .sorted(String::compareToIgnoreCase) .collect(Collectors.joining(", ")); worldGenerator.setText(mainWorldGenerator); moduleNames.setText(modules); loadPreviewImage(item); }

Target:
private void updateDescription(GameInfo item) { if (item == null) { worldGenerator.setText(""); moduleNames.setText(""); loadPreviewImage(null); return; } String mainWorldGenerator = item.getManifest() .getWorldInfo(TerasologyConstants.MAIN_WORLD) .getWorldGenerator() .getObjectName() .toString(); String commaSeparatedModules = item.getManifest() .getModules() .stream() .map(NameVersion::getName) .map(Name::toString) .sorted(String::compareToIgnoreCase) .collect(Collectors.joining(", ")); worldGenerator.setText(mainWorldGenerator); moduleNames.setText(commaSeparatedModules); loadPreviewImage(item); }
Source:
public void testRemoveAllOfTypeForVolume() { List<AuditLog> entries = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries.size()); dao.removeAllOfTypeForVolume(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); List<AuditLog> entries1 = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries1.size()); assertEquals(entries1.get(0).getLogType(), AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED); }

Target:
public void testRemoveAllOfTypeForVolume() { List<AuditLog> entries = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries.size()); dao.removeAllOfTypeForVolume(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); List<AuditLog> entries1 = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries1.size()); assertEquals(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED, entries1.get(0).getLogType()); }
Source:
public void testMultiTrackNative() throws IOException { Assume.assumeTrue("Ignore tests for format: " + formatStringPair.get(mOutFormat), shouldRunTest(mOutFormat)); System.loadLibrary("ctsmediav2codec_jni"); Assume.assumeTrue("Webm fails this test. Bug: 146423022, delete this once fixed", mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_WEBM); String inpPrefix = WorkDir.getMediaDirString(); String srcPathA = inpPrefix + mSrcFileA; String srcPathB = inpPrefix + mSrcFileB; String refPath = File.createTempFile("MuxerTestMTrackRefNat", ".out").getAbsolutePath(); String outPath = File.createTempFile("MuxerTestMTrackNat", ".out").getAbsolutePath(); boolean status = nativeTestMultiTrack(mOutFormat, srcPathA, srcPathB, refPath, outPath); new File(outPath).delete(); new File(refPath).delete(); assertTrue("testMultiTrackNative failed for Format: " + mOutFormat, status); }

Target:
public void testMultiTrackNative() { Assume.assumeTrue(shouldRunTest(mOutFormat)); Assume.assumeTrue("TODO(b/146423022)", mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_WEBM); System.loadLibrary("ctsmediav2codec_jni"); assertTrue(nativeTestMultiTrack(mOutFormat, mInpPathA, mInpPathB, mRefPath, mOutPath)); }
Source:
public AzkabanCommonModuleConfig(final Props props) { this.props = props; this.storageImplementation = props.getString(AZKABAN_STORAGE_TYPE, this.storageImplementation); this.localStorageBaseDirPath = props .getString(AZKABAN_STORAGE_LOCAL_BASEDIR, this.localStorageBaseDirPath); this.hdfsProjectRootUri = props.get(AZKABAN_STORAGE_HDFS_PROJECT_ROOT_URI) != null ? props .getUri(AZKABAN_STORAGE_HDFS_PROJECT_ROOT_URI, true) : null; this.cacheDependencyRootUri = props.get(AZKABAN_STORAGE_CACHE_DEPENDENCY_ROOT_URI) != null ? props .getUri(AZKABAN_STORAGE_CACHE_DEPENDENCY_ROOT_URI, true) : null; this.originDependencyRootUri = props.get(AZKABAN_STORAGE_ORIGIN_DEPENDENCY_ROOT_URI) != null ? props .getUri(AZKABAN_STORAGE_ORIGIN_DEPENDENCY_ROOT_URI, true) : null; }

Target:
public AzkabanCommonModuleConfig(final Props props) { this.props = props; this.storageImplementation = props.getString(AZKABAN_STORAGE_TYPE, this.storageImplementation); this.localStorageBaseDirPath = props.getString(AZKABAN_STORAGE_LOCAL_BASEDIR, this.localStorageBaseDirPath); this.hdfsProjectRootUri = props.getUri(AZKABAN_STORAGE_HDFS_PROJECT_ROOT_URI, null, true); this.cacheDependencyRootUri = props.getUri(AZKABAN_STORAGE_CACHE_DEPENDENCY_ROOT_URI, null, true); this.originDependencyRootUri = props.getUri(AZKABAN_STORAGE_ORIGIN_DEPENDENCY_ROOT_URI, null, true); this.dependencyCachingEnabled = props.getBoolean(AZKABAN_STORAGE_CACHE_DEPENDENCY_ENABLED, true); }
Source:
public void testHgvsDeletionToGenomicVariant() { GenomicVariant variant = GenomicVariant.fromHgvs("1:g.19_21del"); GenomicVariantUtil util = variant.getUtil(); assertEquals(util.getChromosome(), "1"); assertEquals(util.getStart(), (Integer) 19); assertEquals(util.getEnd(), (Integer) 21); assertEquals(util.getRef(), "del"); assertEquals(util.getAlt(), ""); }

Target:
public void testHgvsDeletionToGenomicVariant() { GenomicVariant variant = GenomicVariantUtil.fromHgvs("1:g.4849848_4849857del"); assertEquals("1", variant.getChromosome()); assertEquals(RefType.GENOMIC, variant.getRefType()); assertEquals((Integer) 4849848, variant.getStart()); assertEquals((Integer) 4849857, variant.getEnd()); assertEquals("", variant.getRef()); assertEquals(Type.DELETION, variant.getType()); assertEquals("", variant.getAlt()); }
Source:
private static JAXBContext initJaxbContext() { JAXBContext jaxbContext = null; String contextPath = StringUtils.join( new String[] { CswConstants.OGC_CSW_PACKAGE, CswConstants.OGC_FILTER_PACKAGE, CswConstants.OGC_GML_PACKAGE, CswConstants.OGC_OWS_PACKAGE }, ":"); try { LOGGER.debug("Creating JAXB context with context path: {}.", contextPath); jaxbContext = JAXBContext.newInstance(contextPath, CswJAXBElementProvider.class.getClassLoader()); if (LOGGER.isDebugEnabled()) { LOGGER.debug(jaxbContext.toString()); } } catch (JAXBException e) { LOGGER.info("Unable to create JAXB context using contextPath: {}.", contextPath, e); } return jaxbContext; }

Target:
private static JAXBContext initJaxbContext() { JAXBContext jaxbContext = null; String contextPath = StringUtils.join( new String[] { CswConstants.OGC_CSW_PACKAGE, CswConstants.OGC_FILTER_PACKAGE, CswConstants.OGC_GML_PACKAGE, CswConstants.OGC_OWS_PACKAGE }, ":"); try { LOGGER.debug("Creating JAXB context with context path: {}.", contextPath); jaxbContext = JAXBContext.newInstance(contextPath, CswJAXBElementProvider.class.getClassLoader()); LOGGER.debug("{}", jaxbContext); } catch (JAXBException e) { LOGGER.info("Unable to create JAXB context using contextPath: {}.", contextPath, e); } return jaxbContext; }
Source:
public AlertWithIcon() { initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); }

Target:
public AlertWithIcon() { initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); setAlertType(AlertType.INFO); }
Source:
void operation() throws CentralRepoException; } public static PostgresConnectionSettings loadMultiUserSettings() { PostgresConnectionSettings settings = new PostgresConnectionSettings(); CaseDbConnectionInfo muConn; try { muConn = UserPreferences.getDatabaseConnectionInfo(); } catch (UserPreferencesException ex) { LOGGER.log(Level.SEVERE, "Failed to import settings from multi-user settings.", ex); return settings; } handleTry(() -> settings.setHost(valOrDefault(muConn.getHost(), DEFAULT_HOST))); handleTry(() -> settings.setDbName(DEFAULT_DBNAME)); handleTry(() -> settings.setUserName(valOrDefault(muConn.getUserName(), DEFAULT_USERNAME))); handleTry(() -> settings.setPort(valOrDefault(muConn.getPort(), DEFAULT_PORT, 1, 65535))); handleTry(() -> settings.setBulkThreshold(RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD)); handleTry(() -> settings.setPassword(valOrDefault(muConn.getPassword(), DEFAULT_PASSWORD))); return settings; }

Target:
void operation() throws CentralRepoException, NumberFormatException; } public PostgresConnectionSettings loadMultiUserSettings() { PostgresConnectionSettings settings = new PostgresConnectionSettings(); CaseDbConnectionInfo muConn; try { muConn = UserPreferences.getDatabaseConnectionInfo(); } catch (UserPreferencesException ex) { LOGGER.log(Level.SEVERE, "Failed to import settings from multi-user settings.", ex); return settings; } logException(() -> settings.setHost(muConn.getHost())); logException(() -> settings.setDbName(PostgresConnectionSettings.DEFAULT_DBNAME)); logException(() -> settings.setUserName(muConn.getUserName())); logException(() -> settings.setPort(Integer.parseInt(muConn.getPort()))); logException(() -> settings.setBulkThreshold(RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD)); logException(() -> settings.setPassword(muConn.getPassword())); return settings; }
Source:
public static void serializeMailAddresses( ObjectDataOutput out, MailAddress... addresses ) throws IOException { out.writeInt( addresses.length ); for ( MailAddress address : addresses ) { out.writeUTF( address.getEmail() ); } }

Target:
public static void serializeMailAddresses( ObjectDataOutput out, MailAddress... addresses ) throws IOException { out.writeInt( addresses.length ); for ( MailAddress address : addresses ) { out.writeUTF( address.getEmail() ); String personalName = address.getPersonalName(); boolean hasPersonalName = StringUtils.isNotBlank( personalName ); out.writeBoolean( hasPersonalName ); if ( hasPersonalName ) { out.writeUTF( address.getPersonalName() ); } } }
Source:
public void addPackages(List<String> pkgs) { for (String pkg: pkgs) { packages.add(pkg); } }

Target:
public void addPackages(List<String> pkgs) { packages.addAll(pkgs); }
Source:
private static <T> Predicate<T> hasMember(Path fieldPath, List<Object> values, RequestScope requestScope) { return (T entity) -> { if (values.size() != 1) { throw new InvalidPredicateException("HasMember can only take one argument"); } Object val = getFieldValue(entity, fieldPath, requestScope); String filterStr = CoerceUtil.coerce(values.get(0), String.class); if (val == null) { return false; } if (val instanceof Collection<?>) { return ((Collection<?>) val).contains(filterStr); } if (val instanceof Map<?, ?>) { return ((Map<?, ?>) val).keySet().contains(filterStr); } return false; }; }

Target:
private static <T> Predicate<T> hasMember(Path fieldPath, List<Object> values, RequestScope requestScope) { return (T entity) -> { if (values.size() != 1) { throw new BadRequestException("HasMember can only take one argument"); } Object val = getFieldValue(entity, fieldPath, requestScope); Object filterStr = fieldPath.lastElement() .map(last -> CoerceUtil.coerce(values.get(0), last.getFieldType())) .orElse(CoerceUtil.coerce(values.get(0), String.class)); if (val == null) { return false; } if (val instanceof Collection<?>) { return ((Collection<?>) val).contains(filterStr); } if (val instanceof Map<?, ?>) { return ((Map<?, ?>) val).keySet().contains(filterStr); } return false; }; }