auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected HttpConnection httpOpen(String method, URL u) throws IOException { final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); if (!http.sslVerify && "https".equals(u.getProtocol())) { disableSslVerify(conn); } conn.setRequestMethod(method); conn.setUseCaches(false); conn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); conn.setRequestProperty(HDR_PRAGMA, "no-cache"); conn.setRequestProperty(HDR_USER_AGENT, userAgent); int timeOut = getTimeout(); if (timeOut != -1) { int effTimeOut = timeOut * 1000; conn.setConnectTimeout(effTimeOut); conn.setReadTimeout(effTimeOut); } if (this.headers != null && !this.headers.isEmpty()) { for (Map.Entry<String, String> entry : this.headers.entrySet()) { conn.setRequestProperty(entry.getKey(), entry.getValue()); } } authMethod.configureRequest(conn); return conn; }

Target:
protected HttpConnection httpOpen(String method, URL u) throws IOException { final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); if (!http.sslVerify && "https".equals(u.getProtocol())) { disableSslVerify(conn); } conn.setRequestMethod(method); conn.setUseCaches(false); conn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); conn.setRequestProperty(HDR_PRAGMA, "no-cache"); conn.setRequestProperty(HDR_USER_AGENT, userAgent); int timeOut = getTimeout(); if (timeOut != -1) { int effTimeOut = timeOut * 1000; conn.setConnectTimeout(effTimeOut); conn.setReadTimeout(effTimeOut); } if (this.headers != null && !this.headers.isEmpty()) { for (Map.Entry<String, String> entry : this.headers.entrySet()) conn.setRequestProperty(entry.getKey(), entry.getValue()); } authMethod.configureRequest(conn); return conn; }
Source:
private static Process getProcess(IngesterName name) { Environment environment; try { environment = Environment.valueOf(TelescopeConfiguration.ENVIRONMENT); } catch (IllegalArgumentException e) { log.error("Could not find a telescope environment with the given name, name={}. Falling back to STAGE.", TelescopeConfiguration.ENVIRONMENT); e.printStackTrace(); environment = Environment.STAGE; } return Process.create(name.getIngesterKey(), name.getIngesterName(), environment); }

Target:
private static Process getProcess(IngesterName name) { Environment environment; try { environment = Environment.valueOf(ENVIRONMENT); } catch (IllegalArgumentException e) { environment = Environment.STAGE; log.error( "Could not find a telescope environment with the given name, name={}. Falling back to STAGE.", ENVIRONMENT, e ); } return Process.create(name.getIngesterKey(), name.getIngesterName(), environment); }
Source:
public void returnsEmptyIteratorOnInvalidPartRequest() throws IOException { final String body = "443 N Wolfe Rd, Sunnyvale, CA 94085"; final RqMultipart multi = new RqMultipart.Fake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), contentLengthHeader(body.getBytes().length), contentDispositionHeader( "form-data; name=\"t5\"" ) ), new RqWithHeaders( new RqFake("", "", ""), contentLengthHeader(0), contentDispositionHeader( "form-data; name=\"data\"; filename=\"a.zip\"" ) ) ); try { MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); } finally { multi.body().close(); } }

Target:
public void returnsEmptyIteratorOnInvalidPartRequest() throws IOException { final String body = "443 N Wolfe Rd, Sunnyvale, CA 94085"; final RqMultipart multi = new RqMultipart.Fake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), contentLengthHeader(body.getBytes().length), contentDispositionHeader( "form-data; name=\"t5\"" ) ), new RqWithHeaders( new RqFake("", "", ""), contentLengthHeader(0), contentDispositionHeader( "form-data; name=\"data\"; filename=\"a.zip\"" ) ) ); MatcherAssert.assertThat( multi.part("fake").iterator().hasNext(), Matchers.is(false) ); multi.body().close(); }
Source:
public void activate() { logger.debug("Activate"); }

Target:
public void activate() { logger.debug("GoogleTTS service has been activated"); }
Source:
public void selectRuntimeQueries() { String sql = "SELECT" + " node_id," + " query_id," + " state," + " user," + " query," + " resource_group_id," + " queued_time_ms," + " analysis_time_ms," + " distributed_planning_time_ms," + " created," + " started," + " last_heartbeat," + " 'end' " + "FROM system.runtime.queries"; if (usingTeradataJdbcDriver(defaultQueryExecutor().getConnection())) { assertThat(query(sql)) .hasColumns(VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, BIGINT, BIGINT, BIGINT, TIMESTAMP, TIMESTAMP, TIMESTAMP, VARCHAR) .hasAnyRows(); } else { assertThat(query(sql)) .hasColumns(VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, ARRAY, BIGINT, BIGINT, BIGINT, TIMESTAMP, TIMESTAMP, TIMESTAMP, VARCHAR) .hasAnyRows(); } }

Target:
public void selectRuntimeQueries() { String sql = "SELECT" + " node_id," + " query_id," + " state," + " user," + " query," + " resource_group_id," + " queued_time_ms," + " analysis_time_ms," + " distributed_planning_time_ms," + " created," + " started," + " last_heartbeat," + " 'end' " + "FROM system.runtime.queries"; JDBCType arrayType = usingTeradataJdbcDriver(defaultQueryExecutor().getConnection()) ? VARCHAR : ARRAY; assertThat(query(sql)) .hasColumns(VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, arrayType, BIGINT, BIGINT, BIGINT, TIMESTAMP, TIMESTAMP, TIMESTAMP, VARCHAR) .hasAnyRows(); }
Source:
public SpringAggregateSnapshotter getObject() { if (transactionManager == null) { Map<String, PlatformTransactionManager> candidates = applicationContext.getBeansOfType(PlatformTransactionManager.class); if (candidates.size() == 1) { this.transactionManager = candidates.values().iterator().next(); } } if (eventStore == null) { eventStore = applicationContext.getBean(EventStore.class); } Configuration configuration = applicationContext.getBean(Configuration.class); if (repositoryProvider == null) { repositoryProvider = configuration::repository; } if (parameterResolverFactory == null) { parameterResolverFactory = MultiParameterResolverFactory .ordered(ClasspathParameterResolverFactory.forClass(getObjectType()), new SpringBeanParameterResolverFactory(applicationContext)); } TransactionManager txManager = transactionManager == null ? NoTransactionManager.INSTANCE : new SpringTransactionManager(transactionManager, transactionDefinition); if (deadlineManager == null) { DeadlineTargetLoader deadlineTargetLoader = new DefaultDeadlineTargetLoader(configuration::repository, configuration::sagaRepository); deadlineManager = new SimpleDeadlineManager(txManager, deadlineTargetLoader); } SpringAggregateSnapshotter snapshotter = new SpringAggregateSnapshotter(eventStore, parameterResolverFactory, executor, txManager, repositoryProvider, deadlineManager); snapshotter.setApplicationContext(applicationContext); return snapshotter; }

Target:
public SpringAggregateSnapshotter getObject() { if (transactionManager == null) { Map<String, PlatformTransactionManager> candidates = applicationContext.getBeansOfType(PlatformTransactionManager.class); if (candidates.size() == 1) { this.transactionManager = candidates.values().iterator().next(); } } if (eventStore == null) { eventStore = applicationContext.getBean(EventStore.class); } if (repositoryProvider == null) { repositoryProvider = applicationContext.getBean(Configuration.class)::repository; } if (parameterResolverFactory == null) { parameterResolverFactory = MultiParameterResolverFactory .ordered(ClasspathParameterResolverFactory.forClass(getObjectType()), new SpringBeanParameterResolverFactory(applicationContext)); } if (handlerDefinition == null) { HandlerDefinition definitions = new SpringHandlerDefinitionBean(applicationContext).getObject(); HandlerEnhancerDefinition enhancers = new SpringHandlerEnhancerDefinitionBean(applicationContext) .getObject(); handlerDefinition = MultiHandlerDefinition.ordered(enhancers, definitions); } TransactionManager txManager = transactionManager == null ? NoTransactionManager.INSTANCE : new SpringTransactionManager(transactionManager, transactionDefinition); SpringAggregateSnapshotter snapshotter = new SpringAggregateSnapshotter(eventStore, parameterResolverFactory, handlerDefinition, executor, txManager, repositoryProvider); snapshotter.setApplicationContext(applicationContext); return snapshotter; }
Source:
public void methodInjectionComesAfterInflation() { Menu menu = mock(Menu.class); assertThat(injectMenuActivity.menuIsInflated).isFalse(); injectMenuActivity.onCreateOptionsMenu(menu); assertThat(injectMenuActivity.menuIsInflated).isTrue(); assertThat(injectMenuActivity.methodInjectedMenu).isSameAs(menu); }

Target:
public void methodInjectionComesAfterInflation() { Menu menu = mock(Menu.class); assertThat(injectMenuActivity.menuIsInflated).isFalse(); injectMenuActivity.onCreateOptionsMenu(menu); assertThat(injectMenuActivity.menuIsInflated).isTrue(); }
Source:
protected ICommand getAfterMoveCommand(final MoveRequest request) { ICommand moveCommand = super.getAfterMoveCommand(request); Set<View> viewsToDestroy = new HashSet<View>(); @SuppressWarnings("unchecked") final Iterator<EObject> it = request.getElementsToMove().keySet().iterator(); while (it.hasNext()) { final EObject eObject = it.next(); if (eObject instanceof Generalization) { viewsToDestroy.addAll(getViewsToDestroy(eObject)); viewsToDestroy.addAll(getViewsAccordingToGeneralization((Generalization) eObject)); } else if (eObject instanceof Property || eObject instanceof BehavioralFeature || eObject instanceof Classifier) { viewsToDestroy.addAll(getViewsAccordingToEObject(eObject, request.getTargetContainer())); } } final Iterator<View> viewToDestroyIterator = viewsToDestroy.iterator(); while (viewToDestroyIterator.hasNext()) { final View view = viewToDestroyIterator.next(); final DeleteCommand destroyViewsCommand = new DeleteCommand(request.getEditingDomain(), view); moveCommand = CompositeCommand.compose(moveCommand, destroyViewsCommand); } return moveCommand; }

Target:
protected ICommand getAfterMoveCommand(final MoveRequest request) { ICommand moveCommand = super.getAfterMoveCommand(request); Set<View> viewsToDestroy = new HashSet<View>(); @SuppressWarnings("unchecked") final Iterator<EObject> it = request.getElementsToMove().keySet().iterator(); while (it.hasNext()) { final EObject eObject = it.next(); if (eObject instanceof Generalization) { viewsToDestroy.addAll(getViewsToDestroy(eObject)); viewsToDestroy.addAll(getViewsAccordingToGeneralization((Generalization) eObject)); } else if (eObject instanceof Feature || eObject instanceof Classifier) { viewsToDestroy.addAll(getViewsAccordingToEObject(eObject, request.getTargetContainer())); } } final Iterator<View> viewToDestroyIterator = viewsToDestroy.iterator(); while (viewToDestroyIterator.hasNext()) { final View view = viewToDestroyIterator.next(); final DeleteCommand destroyViewsCommand = new DeleteCommand(request.getEditingDomain(), view); moveCommand = CompositeCommand.compose(moveCommand, destroyViewsCommand); } return moveCommand; }
Source:
public void injectInto(PhoenicisScriptEngine phoenicisScriptEngine) { final Set<String> includedScripts = new HashSet<>(); phoenicisScriptEngine.put("include", (Function<String, Object>) argument -> { final String script = scriptFetcher.getScript(argument); if (script == null) { throwException(new ScriptException(argument + " is not found")); } if (includedScripts.add(argument)) { return phoenicisScriptEngine.evalAndReturn(" this::throwException); } return null; }, this::throwException); }

Target:
public void injectInto(PhoenicisScriptEngine phoenicisScriptEngine) { final Set<String> includedScripts = new HashSet<>(); phoenicisScriptEngine.put("include", (Consumer<String>) argument -> { final String script = scriptFetcher.getScript(argument); if (script == null) { throwException(new ScriptException(argument + " is not found")); } if (includedScripts.add(argument)) { phoenicisScriptEngine.eval(" this::throwException); } }, this::throwException); }
Source:
public void setup(Context.OperatorContext context) { super.setup(context); apexPythonEngine = initApexPythonEngineImpl(context); Map<PythonInterpreterConfig,Object> preInitConfigurations = getPreInitConfigurations(); apexPythonEngine.preInitInterpreter(preInitConfigurations); apexPythonEngine.startInterpreter(); apexPythonEngine.postStartInterpreter(); initPartitioner(); processPostSetUpPythonInstructions(apexPythonEngine); }

Target:
public void setup(Context.OperatorContext context) { super.setup(context); LOG.debug("Initializing the python interpreter setup"); apexPythonEngine = initApexPythonEngineImpl(context); Map<PythonInterpreterConfig,Object> preInitConfigurations = getPreInitConfigurations(); apexPythonEngine.preInitInterpreter(preInitConfigurations); apexPythonEngine.startInterpreter(); LOG.debug("Python interpreter started. Now invoking post interpreter logic"); processPostSetUpPythonInstructions(apexPythonEngine); LOG.debug("Python post interpreter logic complete"); }
Source:
public void closeDropdown() { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].classList.remove('active')", exploreWikiaDropdown); }

Target:
public void closeDropdown() { ((JavascriptExecutor) driver) .executeScript("arguments[0].classList.remove('active')", exploreWikiaDropdown); }
Source:
protected static SerializationConfig createSerializationConfig() { return new SerializationConfig() .setAllowUnsafe(true) .setUseNativeByteOrder(true); }

Target:
protected static SerializationConfig createSerializationConfig() { SerializationConfig serializationConfig = new SerializationConfig(); if (USE_NATIVE_MEMORY_SERIALIZATION) { serializationConfig = serializationConfig .setAllowUnsafe(true) .setUseNativeByteOrder(true); } return serializationConfig; }
Source:
private String[] readURL(String urlIn){ List<String> outList = new ArrayList<String>(); try { URL url = new URL(urlIn); URLConnection urlConnection = url.openConnection(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line; while ((line = bufferedReader.readLine()) != null) { outList.add(line); } bufferedReader.close(); } catch(Exception e) { e.printStackTrace(); } return outList.toArray(new String[0]); }

Target:
private String[] readURL(String urlIn) throws IOException{ List<String> outList = new ArrayList<String>(); URL url = new URL(urlIn); URLConnection urlConnection = url.openConnection(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line; while ((line = bufferedReader.readLine()) != null) { outList.add(line); } bufferedReader.close(); return outList.toArray(new String[0]); }
Source:
@Override protected void beforeTestsStarted() throws Exception { startGrids(1); }

Target:
@Override protected void beforeTestsStarted() throws Exception { IgniteEx ignite = startGrids(1); IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME); cache.put(1, "11"); cache.put(2, "12"); cache.put(3, "13"); }
Source:
public CompositeLogoutHandler(LogoutHandler... logoutHandlers) { this.logoutHandlers = Arrays.asList(logoutHandlers); }

Target:
public CompositeLogoutHandler(LogoutHandler... logoutHandlers) { Assert.notEmpty(logoutHandlers, "LogoutHandlers are required"); this.logoutHandlers = Arrays.asList(logoutHandlers); }
Source:
public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_UST); if (isVersionSupported("2.1.0")) { command.add(LTTngControlServiceConstants.OPTION_FIELDS); } ICommandResult result = executeCommand(command, monitor, false); List<IUstProviderInfo> allProviders = new ArrayList<>(); if (!isVersionSupported("2.1.0") && (result.getResult() != 0)) { return allProviders; } if (result.getErrorOutput().size() > 0) { if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_UST_NO_UST_PROVIDER_PATTERN)) { return allProviders; } } if (isError(result)) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + toCommandString(command) + "\n" + result.toString()); } IUstProviderInfo provider = null; int index = 0; while (index < result.getOutput().size()) { String line = result.getOutput().get(index); Matcher matcher = LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line); if (matcher.matches()) { provider = new UstProviderInfo(matcher.group(2).trim()); provider.setPid(Integer.valueOf(matcher.group(1).trim())); List<IBaseEventInfo> events = new ArrayList<>(); index = getProviderEventInfo(result.getOutput(), ++index, events); provider.setEvents(events); allProviders.add(provider); } else { index++; } } return allProviders; }

Target:
public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_UST); if (isVersionSupported("2.1.0")) { command.add(LTTngControlServiceConstants.OPTION_FIELDS); } ICommandResult result = executeCommand(command, monitor, false); List<IUstProviderInfo> allProviders = new ArrayList<>(); if (!isVersionSupported("2.1.0") && (result.getResult() != 0)) { return allProviders; } if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_UST_NO_UST_PROVIDER_PATTERN)) { return allProviders; } if (isError(result)) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + toCommandString(command) + "\n" + result.toString()); } IUstProviderInfo provider = null; int index = 0; while (index < result.getOutput().size()) { String line = result.getOutput().get(index); Matcher matcher = LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line); if (matcher.matches()) { provider = new UstProviderInfo(matcher.group(2).trim()); provider.setPid(Integer.valueOf(matcher.group(1).trim())); List<IBaseEventInfo> events = new ArrayList<>(); index = getProviderEventInfo(result.getOutput(), ++index, events); provider.setEvents(events); allProviders.add(provider); } else { index++; } } return allProviders; }
Source:
public IndexCapability getCapability( SchemaIndexDescriptor schemaIndexDescriptor ) { IndexCapability[] capabilities = instancesAs( selector, new IndexCapability[providers.length], provider -> provider.getCapability( schemaIndexDescriptor ) ); return new UnionIndexCapability( capabilities ) { @Override public IndexOrder[] orderCapability( ValueCategory... valueCategories ) { if ( valueCategories.length == 1 && valueCategories[0] == ValueCategory.UNKNOWN ) { return ORDER_NONE; } return super.orderCapability( valueCategories ); } }; }

Target:
public IndexCapability getCapability( SchemaIndexDescriptor schemaIndexDescriptor ) { IndexCapability[] capabilities = providers.instancesAs( new IndexCapability[INSTANCE_COUNT], provider -> provider.getCapability( schemaIndexDescriptor ) ); return new UnionIndexCapability( capabilities ) { @Override public IndexOrder[] orderCapability( ValueCategory... valueCategories ) { if ( valueCategories.length == 1 && valueCategories[0] == ValueCategory.UNKNOWN ) { return ORDER_NONE; } return super.orderCapability( valueCategories ); } }; }
Source:
public static void addPeopleSave(final Context context, Set<String> emails) { Log.e(TAG, "emails: " + emails); String title = context.getResources().getString(R.string.add_contact); String message = TextUtils.join(", ", emails) + context.getResources().getString(R.string.add_contact_dialog_save); showDialog(context, title, message); }

Target:
public static void addPeopleSave(final Context context, Set<String> emails) { Log.e(TAG, "emails: " + emails); String title = context.getResources().getString(R.string.add_contact); String message = context.getResources().getString(R.string.add_contact_dialog_save, TextUtils.join(", ", emails)); showDialog(context, title, message); }
Source:
public static SimpleFeatureCollection read(SimpleFeatureSource src, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws Exception { DefaultFeatureCollection fc = new DefaultFeatureCollection(); SimpleFeatureCollection sfc = src.getFeatures(); MathTransform transform = getTransform(sourceCRS, targetCRS); try (SimpleFeatureIterator it = sfc.features()) { while (it.hasNext()) { SimpleFeature f = it.next(); if (transform != null) { Object g = f.getDefaultGeometry(); if (g != null) { Geometry transformed = JTS.transform((Geometry) g, transform); f.setDefaultGeometry(transformed); } } fc.add(f); } } return fc; }

Target:
public static SimpleFeatureCollection read(SimpleFeatureSource src, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws Exception { DefaultFeatureCollection fc = new DefaultFeatureCollection(); SimpleFeatureCollection sfc = src.getFeatures(); MathTransform transform = getTransform(sourceCRS, targetCRS); try (SimpleFeatureIterator it = sfc.features()) { while (it.hasNext()) { SimpleFeature f = it.next(); Object g = f.getDefaultGeometry(); if (g != null) { Geometry transformed = JTS.transform((Geometry) g, transform); f.setDefaultGeometry(transformed); } fc.add(f); } } return fc; }
Source:
public Optional<String> getString(String key) { return Optional.ofNullable(getDescriptors().get(key)).map(ConfigurationPropertyDescriptor::getValue); }

Target:
public Optional<String> getString(String key) { return Optional.ofNullable(getDescriptors().get(key)) .map(ConfigurationPropertyDescriptor::getValue) .filter(StringUtils::isNotBlank); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(" |-- ").append(getIdentification()).append(": "); sb.append(getName()).append(" "); sb.append("(").append(getType()).append(") "); sb.append("Maj:Min=").append(getMajor()).append(":").append(getMinor()).append(", "); sb.append("size: ").append(FormatUtil.formatBytesDecimal(getSize())); sb.append(getMountPoint().isEmpty() ? "" : " @ " + getMountPoint()).append("\n"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getIdentification()).append(": "); sb.append(getName()).append(" "); sb.append("(").append(getType()).append(") "); sb.append("Maj:Min=").append(getMajor()).append(":").append(getMinor()).append(", "); sb.append("size: ").append(FormatUtil.formatBytesDecimal(getSize())); sb.append(getMountPoint().isEmpty() ? "" : " @ " + getMountPoint()); return sb.toString(); }
Source:
public void edit(final GlusterVolumeSnapshotModel object) { driver.edit(object); disableCliScheduleEditor.setVisible(false); object.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { GlusterVolumeSnapshotModel model = (GlusterVolumeSnapshotModel) sender; if ("disableCliScheduleChkBox".equals(args.propertyName)) { disableCliScheduleEditor.setVisible(model.isDisableCliScheduleChkBoxVisible()); } } }); updateVisibilities(object); updateTabVisibilities(object); }

Target:
public void edit(final GlusterVolumeSnapshotModel object) { driver.edit(object); disableCliScheduleEditor.setVisible(false); updateVisibilities(object); updateTabVisibilities(object); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getGlusterVolume() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID); return false; } setVdsGroupId(getGlusterVolume().getClusterId()); return true; }

Target:
protected boolean canDoAction() { if (getGlusterVolume() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID); return false; } setVdsGroupId(getGlusterVolume().getClusterId()); if (!super.canDoAction()) { return false; } return true; }
Source:
private boolean addEndpoints(MutableCapacityGraph<Vertex, Integer> capacityGraph, RangeVertex rangeVertex, boolean localDCCheck) { boolean sourceFound = false; Replicas.checkFull(rangesWithSources.get(rangeVertex.getRange())); for (Replica replica : rangesWithSources.get(rangeVertex.getRange())) { if (passFilters(replica, localDCCheck)) { sourceFound = true; if (replica.getEndpoint().equals(FBUtilities.getBroadcastAddressAndPort())) continue; final Vertex endpointVertex = new EndpointVertex(replica.getEndpoint()); capacityGraph.insertVertex(rangeVertex); capacityGraph.insertVertex(endpointVertex); capacityGraph.addEdge(rangeVertex, endpointVertex, Integer.MAX_VALUE); } } return sourceFound; }

Target:
private boolean addEndpoints(MutableCapacityGraph<Vertex, Integer> capacityGraph, RangeVertex rangeVertex, boolean localDCCheck) { boolean sourceFound = false; Replicas.checkFull(rangesWithSources.get(rangeVertex.getRange())); for (Replica replica : rangesWithSources.get(rangeVertex.getRange())) { if (passFilters(replica, localDCCheck)) { sourceFound = true; if (replica.isLocal()) continue; final Vertex endpointVertex = new EndpointVertex(replica.getEndpoint()); capacityGraph.insertVertex(rangeVertex); capacityGraph.insertVertex(endpointVertex); capacityGraph.addEdge(rangeVertex, endpointVertex, Integer.MAX_VALUE); } } return sourceFound; }
Source:
public int compare(final Contentlet contentlet1, final Contentlet contentlet2) { try { Object value1 = contentlet1.get(field); Object value2 = contentlet2.get(field); int ret = 0; if (value1 == null || value2 == null) { return ret; } else if (value1 instanceof Integer) { ret = ((Integer)value1).compareTo((Integer)value2); } else if (value1 instanceof Long) { ret = ((Long)value1).compareTo((Long)value2); } else if (value1 instanceof Date) { ret = ((Date)value1).compareTo((Date)value2); } else if (value1 instanceof Float) { ret = ((Float)value1).compareTo((Float)value2); } else if (value1 instanceof Boolean) { ret = ((Boolean)value1).compareTo((Boolean)value2); } else { ret = ((String)value1).compareTo((String)value2); } if (direction.equals("asc")) { return ret; } return ret * -1; } catch (Exception e) { Logger.warnAndDebug(ContentMapComparator.class, "Error sorting contents using criteria: " + field + " " + direction, e); } return 0; }

Target:
public int compare(final Contentlet contentlet1, final Contentlet contentlet2) { try { Object value1 = contentlet1.get(field); Object value2 = contentlet2.get(field); int ret = 0; if (value1 == null || value2 == null) { return ret; } else if (value1 instanceof Integer && value2 instanceof Integer) { ret = ((Integer)value1).compareTo((Integer)value2); } else if (value1 instanceof Long && value2 instanceof Long) { ret = ((Long)value1).compareTo((Long)value2); } else if (value1 instanceof Date && value2 instanceof Date) { ret = ((Date)value1).compareTo((Date)value2); } else if (value1 instanceof Float && value2 instanceof Float) { ret = ((Float)value1).compareTo((Float)value2); } else if (value1 instanceof Boolean && value2 instanceof Boolean) { ret = ((Boolean)value1).compareTo((Boolean)value2); } else { ret = (String.valueOf(value1)).compareTo(String.valueOf(value2)); } if (direction.equals("asc")) { return ret; } return ret * -1; } catch (Exception e) { Logger.warnAndDebug(ContentMapComparator.class, "Error sorting contents using criteria: " + field + " " + direction, e); } return 0; }
Source:
private boolean isInvalidJson(String json) { try { new JsonParser().parse(json); return false; } catch (Exception e) { return false; } }

Target:
private boolean isInvalidJson(String json) { try { new JsonParser().parse(json); return false; } catch (Exception e) { return true; } }
Source:
public void test_DnDPackageFromMC2DiagramBlank2() throws Exception { openRepresentation2(); try { openErrorLogViewByAPI(); bot.views(); SWTBot errorLogBot = bot.viewByPartName("Error Log").bot(); int rowCount = errorLogBot.tree().rowCount(); DndUtil util = new DndUtil(bot.getDisplay()); final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).getNode(CONTAINER_TO_DRAG_P1); util.dragAndDrop(ecoreTreeItem, editor.getCanvas()); bot.waitUntil(new DiagramWithChildrensCondition(editor, 1)); assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount()); IGraphicalEditPart p1EditPart = (IGraphicalEditPart) editor.getEditPart(CONTAINER_TO_DRAG_P1, DNodeContainerEditPart.class).part(); checkEditPartLocation(p1EditPart); } finally { closeErrorLogView(); } }

Target:
public void test_DnDPackageFromMC2DiagramBlank2() throws Exception { openRepresentation2(); try { openErrorLogViewByAPI(); SWTBot errorLogBot = bot.viewByPartName("Error Log").bot(); int rowCount = errorLogBot.tree().rowCount(); DndUtil util = new DndUtil(bot.getDisplay()); final SWTBotTreeItem ecoreTreeItem = semanticResourceNode.expandNode(ROOTPACKAGE_NAME).getNode(CONTAINER_TO_DRAG_P1); util.dragAndDrop(ecoreTreeItem, editor.getCanvas()); bot.waitUntil(new DiagramWithChildrensCondition(editor, 1)); assertEquals("An error message was generated !", rowCount, errorLogBot.tree().rowCount()); IGraphicalEditPart p1EditPart = (IGraphicalEditPart) editor.getEditPart(CONTAINER_TO_DRAG_P1, DNodeContainerEditPart.class).part(); checkEditPartLocation(p1EditPart); } finally { closeErrorLogView(); } }
Source:
public Animation() { listeners = new ArrayList<AnimationListener>(); frames = new ArrayList<Frame>(); currentState = AnimState.PRESTART; repeat = 0; elapsedTime = 0; currentFrame = 0; }

Target:
public Animation() { currentState = AnimState.PRESTART; currentRepeatCount = 0; repeatCount = 0; elapsedTime = 0; currentFrame = 0; repeatMode = RepeatMode.REPEAT_INFINITE; }
Source:
public File newFolder(String... paths) throws IOException { if (paths.length == 0) { throw new IllegalArgumentException("must pass at least one path"); } File root = getRoot(); for (String path : paths) { if (new File(path).isAbsolute()) { throw new IOException("folder path \'" + path + "\' is not a relative path"); } } File relativePath = null; File file = root; boolean lastMkdirsCallSuccessful = true; for (String path : paths) { relativePath = new File(relativePath, path); file = new File(root, relativePath.getPath()); lastMkdirsCallSuccessful = file.mkdirs(); if (!lastMkdirsCallSuccessful) { if (file.exists() && file.isDirectory()) { continue; } else if (file.exists()) { throw new IOException( "a file with the path \'" + relativePath.getPath() + "\' exists"); } else { throw new IOException( "could not create a folder with the path \'" + relativePath.getPath() + "\'"); } } } if (!lastMkdirsCallSuccessful) { throw new IOException( "a folder with the path \'" + relativePath.getPath() + "\' already exists"); } return file; }

Target:
public File newFolder(String... paths) throws IOException { if (paths.length == 0) { throw new IllegalArgumentException("must pass at least one path"); } File root = getRoot(); for (String path : paths) { if (new File(path).isAbsolute()) { throw new IOException("folder path \'" + path + "\' is not a relative path"); } } File relativePath = null; File file = root; boolean lastMkdirsCallSuccessful = true; for (String path : paths) { relativePath = new File(relativePath, path); file = new File(root, relativePath.getPath()); lastMkdirsCallSuccessful = file.mkdirs(); if (!lastMkdirsCallSuccessful && !file.isDirectory()) { if (file.exists()) { throw new IOException( "a file with the path \'" + relativePath.getPath() + "\' exists"); } else { throw new IOException( "could not create a folder with the path \'" + relativePath.getPath() + "\'"); } } } if (!lastMkdirsCallSuccessful) { throw new IOException( "a folder with the path \'" + relativePath.getPath() + "\' already exists"); } return file; }
Source:
protected void connect() { if (isConnected()) { return; } if (client == null) { client = clientBuilder.build(); } client.start(); try { LOG.info("Connecting to ZooKeeper with client: ", client); client.blockUntilConnected(); LOG.info("Connected to ZooKeeper"); } catch (InterruptedException e) { LOG.warn("Interrupted while connecting to ZooKeeper", e); } if (leaderSelector == null) { leaderSelector = new LeaderSelector(client, "/" + getDomain(), leaderSelectorListener); } leaderSelector.autoRequeue(); leaderSelector.start(); }

Target:
protected void connect() { if (isConnected()) { return; } if (client == null) { client = clientBuilder.build(); } client.start(); boolean blocked = true; while (blocked) { try { LOG.info("Connecting to ZooKeeper with client {}", client); client.blockUntilConnected(); blocked = false; LOG.info("Connected to ZooKeeper"); } catch (InterruptedException e) { LOG.warn("Interrupted while connecting to ZooKeeper", e); } } if (leaderSelector == null) { leaderSelector = new LeaderSelector(client, "/" + getDomain(), leaderSelectorListener); } leaderSelector.autoRequeue(); leaderSelector.start(); }
Source:
public Document(JsonNode json) { this.fields = new HashMap<>(); json.fields().forEachRemaining( e -> { if ("coreId".equals(e.getKey())) { this.id = (json.get("doi").asText().equals("null")) ? json.get("coreId").asText() : "doi:" + json.get("doi").asText(); } else if ("abstract".equals(e.getKey())) { this.contents = json.get("title").asText() + "\n" + json.get("abstract").asText(); } else if ("topics".equals(e.getKey())) { ArrayNode arrayField = (ArrayNode) e.getValue(); StringJoiner sj = new StringJoiner(" "); arrayField.elements().forEachRemaining( arrayElement -> { sj.add(arrayElement.asText()); }); this.fields.put(e.getKey(), sj.toString()); } else { this.fields.put(e.getKey(), e.getValue().asText()); } }); }

Target:
public Document(JsonNode json) { this.fields = new HashMap<>(); json.fields().forEachRemaining( e -> { if ("coreId".equals(e.getKey())) { this.id = (json.get("doi").asText().equals("null")) ? json.get("coreId").asText() : "doi:" + json.get("doi").asText(); } else if ("abstract".equals(e.getKey())) { this.contents = json.get("title").asText() + "\n" + json.get("abstract").asText(); } else if (e.getValue() instanceof ArrayNode) { ArrayNode arrayField = (ArrayNode) e.getValue(); StringJoiner sj = new StringJoiner("::"); arrayField.elements().forEachRemaining( arrayElement -> { sj.add(arrayElement.asText()); }); this.fields.put(e.getKey(), sj.toString()); } else { this.fields.put(e.getKey(), e.getValue().asText()); } }); }
Source:
public void init(final GlusterVolumeSnapshotModel model) { super.init(model); model.getInterval().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(((ListModel<String>) sender).getSelectedItem())); } }); model.getRecurrence().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().updateVisibilities(model); getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(model.getInterval().getSelectedItem())); getView().setMessage(null); } }); model.getEndByOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setEndDateVisibility(model); } }); model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("Message".equals(args.propertyName)) { getView().setMessage(model.getMessage()); } } }); }

Target:
public void init(final GlusterVolumeSnapshotModel model) { super.init(model); model.getInterval().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(((ListModel<String>) sender).getSelectedItem())); } }); model.getRecurrence().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().updateVisibilities(model); getView().setCriticalIntervalLabelVisibility(model, Integer.parseInt(model.getInterval().getSelectedItem())); getView().setMessage(null); } }); model.getEndByOptions().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { getView().setEndDateVisibility(model); } }); }
Source:
public void close() { List<Thread> closeThreads = new LinkedList<>(); Collection<InterpreterSetting> intpSettings = interpreterSettings.values(); for (final InterpreterSetting intpSetting : intpSettings) { Thread t = new Thread() { public void run() { intpSetting.close(); } }; t.start(); closeThreads.add(t); } for (Thread t : closeThreads) { try { t.join(); } catch (InterruptedException e) { LOGGER.error("Can't close interpreterGroup", e); } } }

Target:
public void close() { List<Thread> closeThreads = new LinkedList<>(); for (final InterpreterSetting intpSetting : interpreterSettings.values()) { Thread t = new Thread() { public void run() { intpSetting.close(); } }; t.start(); closeThreads.add(t); } for (Thread t : closeThreads) { try { t.join(); } catch (InterruptedException e) { LOGGER.error("Can't close interpreterGroup", e); } } }
Source:
private Flow convertAzkabanFlowToFlow(final AzkabanFlow azkabanFlow, final String flowName, final File flowFile) { final Flow flow = new Flow(flowName); final Props props = azkabanFlow.getProps(); FlowLoaderUtils.addEmailPropsToFlow(flow, props); props.setSource(flowFile.getName()); final List<FlowProps> flowPropsList = new ArrayList<>(); flowPropsList.add(new FlowProps(props)); flow.addAllFlowProperties(flowPropsList); azkabanFlow.getNodes().values().stream() .map(n -> convertAzkabanNodeToNode(n, flowName, flowFile)) .forEach(n -> flow.addNode(n)); buildFlowEdges(azkabanFlow, flowName); flow.addAllEdges(this.edgeMap.get(flowName)); flow.initialize(); return flow; }

Target:
private Flow convertAzkabanFlowToFlow(final AzkabanFlow azkabanFlow, final String flowName, final File flowFile) { final Flow flow = new Flow(flowName); final Props props = azkabanFlow.getProps(); FlowLoaderUtils.addEmailPropsToFlow(flow, props); props.setSource(flowFile.getName()); flow.addAllFlowProperties(ImmutableList.of(new FlowProps(props))); azkabanFlow.getNodes().values().stream() .map(n -> convertAzkabanNodeToNode(n, flowName, flowFile)) .forEach(n -> flow.addNode(n)); buildFlowEdges(azkabanFlow, flowName); flow.addAllEdges(this.edgeMap.get(flowName)); flow.initialize(); return flow; }
Source:
public boolean isQualifiedForConsoleConnect() { return this == PoweringUp || this == Up || this == RebootInProgress || this == PoweringDown || this == Paused; }

Target:
public boolean isQualifiedForConsoleConnect() { return this == PoweringUp || this == Up || this == RebootInProgress || this == PoweringDown || this == Paused || this == MigratingFrom || this == SavingState; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestAddress that = (TestAddress) o; if (addressNum != that.addressNum) return false; return name != null ? name.equals(that.name) : that.name == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestAddress that = (TestAddress) o; return addressNum == that.addressNum && Objects.equals(name, that.name); }
Source:
private void assertFilesAreOpen() { List<TextEditor> textEditors = getOpenEditorsByType(TextEditor.class); assertEquals(2, textEditors.size()); Set<String> actualSet = new HashSet<String>(); actualSet.addAll(FluentIterable.from(textEditors).transform(new Function<TextEditor, String>() { @Override public String apply(TextEditor editor) { return editor.getTitle(); } }).toSet()); assertTrue(actualSet.contains(fileA.getName())); assertTrue(actualSet.contains(fileB.getName())); }

Target:
private void assertFilesAreOpen() { Set<TextEditor> textEditors = getOpenEditorsByType(TextEditor.class); assertEquals(2, textEditors.size()); Set<String> editorTitles = FluentIterable.from(textEditors).transform(new Function<TextEditor, String>() { @Override public String apply(TextEditor editor) { return editor.getTitle(); } }).toSet(); assertTrue(editorTitles.contains(fileA.getName())); assertTrue(editorTitles.contains(fileB.getName())); }
Source:
public final TestObserver<T> assertValue(Predicate<T> valuePredicate) { int s = values.size(); if (s == 0) { throw fail("No values"); } boolean found = false; for (T value : values) { try { if (valuePredicate.test(value)) { found = true; break; } } catch (Exception ex) { throw ExceptionHelper.wrapOrThrow(ex); } } if (found) { if (s != 1) { throw fail("Value present but other values as well"); } } else { throw fail("Value not present"); } return this; }

Target:
public final TestObserver<T> assertValue(Predicate<T> valuePredicate) { int s = values.size(); if (s == 0) { throw fail("No values"); } boolean found = false; try { if (valuePredicate.test(values.get(0))) { found = true; } } catch (Exception ex) { throw ExceptionHelper.wrapOrThrow(ex); } if (found) { if (s != 1) { throw fail("Value present but other values as well"); } } else { throw fail("Value not present"); } return this; }
Source:
private void createObjectsWithOldPrimaryKey(final String className, final boolean insertNullValue) { DynamicRealm realm = DynamicRealm.getInstance(configFactory.createConfigurationBuilder().build()); realm.executeTransaction(new DynamicRealm.Transaction() { @Override public void execute(DynamicRealm realm) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, "12"); if (insertNullValue) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, null); } } }); realm.close(); }

Target:
private void createObjectsWithOldPrimaryKey(final String className, final boolean insertNullValue) { DynamicRealm realm = DynamicRealm.getInstance(configFactory.createConfigurationBuilder().build()); try { realm.executeTransaction(new DynamicRealm.Transaction() { @Override public void execute(DynamicRealm realm) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, "12"); if (insertNullValue) { realm.createObject(className).setString(MigrationPrimaryKey.FIELD_PRIMARY, null); } } }); } finally { realm.close(); } }
Source:
public void should_add_authentication_header_to_request() throws Exception { HttpClient httpClientSpy = spy(new HttpClient()); GitHubLastUpdateCache gitHubLastUpdateCache = new GitHubLastUpdateCache(folder.newFolder()); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(GitHubSource.GITHUB_USERNAME_PROPERTY, "my-username"); capabilities.setCapability(GitHubSource.GITHUB_TOKEN_PROPERTY, "my-token"); GeckoDriverGitHubSource geckoDriverGitHubSource = new GeckoDriverGitHubSource(httpClientSpy, gitHubLastUpdateCache, capabilities); geckoDriverGitHubSource.getReleaseForVersion("v0.14.0"); verify(httpClientSpy, times(1)).get(anyString(), argThat(headers -> { if (headers.size() > 0) { String authorization = headers.get("Authorization"); if (authorization != null && authorization.startsWith("Basic ")) { String tokens = new String(Base64.getDecoder().decode(authorization.substring(6, authorization.length() - 1))); if ("my-username:my-token".equals(tokens)) { return true; } else { log.severe(String.format( "The auth param value should contain: [my-username:my-token] but contains: [%s]", tokens)); } } else { log.severe("There is no header pair with key: 'Authorization' and value starting with 'Basic'"); } } else { log.severe("The map doesn't contain any header param"); } return false; })); }

Target:
public void should_add_authentication_header_to_request() throws Exception { HttpClient httpClientSpy = spy(new HttpClient()); GitHubLastUpdateCache gitHubLastUpdateCache = new GitHubLastUpdateCache(folder.newFolder()); String username = "my-username"; String token = "my-token"; DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(GITHUB_USERNAME_PROPERTY, username); capabilities.setCapability(GITHUB_TOKEN_PROPERTY, token); GeckoDriverGitHubSource geckoDriverGitHubSource = new GeckoDriverGitHubSource(httpClientSpy, gitHubLastUpdateCache, capabilities); geckoDriverGitHubSource.getReleaseForVersion("v0.14.0"); verify(httpClientSpy, times(1)).get(anyString(), argThat(headers -> containsAuthHeaderParam(headers, username + ":" + token))); }
Source:
public FactorCriteria orderByType() { return null; }

Target:
public FactorCriteria orderByType() { return orderBy(DefaultSmsFactor.TYPE); }
Source:
public AbstractSearchQuery(String namespace, String queryString) { m_namespace = namespace; m_queryString = queryString; }

Target:
public AbstractSearchQuery(String namespace, String queryString) { m_namespace = Objects.requireNonNull(namespace); m_queryString = queryString; }
Source:
public void onPost(final GitLabPushRequest req) { final ParameterizedJobMixIn scheduledJob = new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }; if (triggerOnPush && this.isBranchAllowed(this.getSourceBranch(req))) { LOGGER.log(Level.INFO, "{0} triggered for push.", job.getFullName()); String name = " #" + job.getNextBuildNumber(); Action[] actions = createActions(req, job); int projectbuildDelay = 0; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob)job; if (abstractProject.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = abstractProject.getQuietPeriod(); } } if(addCiMessage) { req.createCommitStatus(getDescriptor().getGitlab().instance(), "pending", Jenkins.getInstance().getRootUrl() + job.getUrl()); } scheduledJob.scheduleBuild2(projectbuildDelay, actions); } }

Target:
public void onPost(final GitLabPushRequest req) { final ParameterizedJobMixIn scheduledJob = new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }; if (triggerOnPush && this.isBranchAllowed(this.getSourceBranch(req))) { LOGGER.log(Level.INFO, "{0} triggered for push.", job.getFullName()); Action[] actions = createActions(req, job); int projectbuildDelay = 0; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob abstractProject = (ParameterizedJobMixIn.ParameterizedJob)job; if (abstractProject.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = abstractProject.getQuietPeriod(); } } if(addCiMessage) { req.createCommitStatus(getDescriptor().getGitlab().instance(), "pending", Jenkins.getInstance().getRootUrl() + job.getUrl()); } scheduledJob.scheduleBuild2(projectbuildDelay, actions); } }
Source:
T toTraversable(Value<V> value, T empty, Function<V, T> ofElement, Function<Iterable<V>, T> ofAll) { if (value.isEmpty()) { return empty; } else if (value.isSingleValued()) { return ofElement.apply(value.get()); } else { return ofAll.apply(value); } }

Target:
static <T extends Traversable<V>, V> T toTraversable( Value<V> value, T empty, Function<V, T> ofElement, Function<Iterable<V>, T> ofAll) { if (value.isEmpty()) { return empty; } else if (value.isSingleValued()) { return ofElement.apply(value.get()); } else { return ofAll.apply(value); } }
Source:
public void addAll(Stream<? extends DocumentWriteOperation> operations) { Iterator<? extends DocumentWriteOperation> docWriteItr = operations.iterator(); docWriteItr.forEachRemaining(this::add); }

Target:
public void addAll(Stream<? extends DocumentWriteOperation> operations) { operations.forEach(this::add); }