auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void stop() { if (initiatedShutdown.compareAndSet(false, true)) { LOG.info("Shutting down JobCoordinator."); boolean shutdownSuccessful = false; metrics.isLeader.set(false); try { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } debounceTimer.stopScheduler(); if (leaderElector.amILeader()) { LOG.info("Resigning leadership for processorId: " + processorId); leaderElector.resignLeadership(); } LOG.info("Shutting down ZkUtils."); if (zkUtils != null) { zkUtils.close(); } LOG.debug("Shutting down system admins."); systemAdmins.stop(); if (streamPartitionCountMonitor != null) { streamPartitionCountMonitor.stop(); } if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } <START> jobModelMetaStore.close(); <END> shutdownSuccessful = true; } catch (Throwable t) { LOG.error("Encountered errors during job coordinator stop.", t); if (coordinatorListener != null) { coordinatorListener.onCoordinatorFailure(t); } } finally { LOG.info("Job Coordinator shutdown finished with ShutdownComplete=" + shutdownSuccessful); } } else { LOG.info("Job Coordinator shutdown is in progress!"); } }</code><technical_language>need call start/init? is called</technical_language>

Target:
public void stop() { if (initiatedShutdown.compareAndSet(false, true)) { LOG.info("Shutting down JobCoordinator."); boolean shutdownSuccessful = false; metrics.isLeader.set(false); try { if (coordinatorListener != null) { coordinatorListener.onJobModelExpired(); } debounceTimer.stopScheduler(); if (leaderElector.amILeader()) { LOG.info("Resigning leadership for processorId: " + processorId); leaderElector.resignLeadership(); } LOG.info("Shutting down ZkUtils."); if (zkUtils != null) { zkUtils.close(); } LOG.debug("Shutting down system admins."); systemAdmins.stop(); if (streamPartitionCountMonitor != null) { streamPartitionCountMonitor.stop(); } if (coordinatorListener != null) { coordinatorListener.onCoordinatorStop(); } jobModelMetadataStore.close(); shutdownSuccessful = true; } catch (Throwable t) { LOG.error("Encountered errors during job coordinator stop.", t); if (coordinatorListener != null) { coordinatorListener.onCoordinatorFailure(t); } } finally { LOG.info("Job Coordinator shutdown finished with ShutdownComplete=" + shutdownSuccessful); } } else { LOG.info("Job Coordinator shutdown is in progress!"); } }
Source:
<code>public double getCrossValidatedLoss(PredictiveModelBuilder<? extends PredictiveModel> predictiveModelBuilder, Iterable<? extends AbstractInstance> rawTrainingData) { initializeTrainingAndValidationSets(rawTrainingData); double runningLoss = 0; double runningWeightOfValidationSet = 0; while (true) { PredictiveModel predictiveModel = predictiveModelBuilder.buildPredictiveModel(trainingDataToAddToPredictiveModel); runningLoss += crossValLoss.getLoss(validationSet, predictiveModel) * weightOfValidationSet; runningWeightOfValidationSet += weightOfValidationSet; logger.info("running Loss: " + runningLoss / runningWeightOfValidationSet); updateCrossValidationAndTrainingSets(); <START> if (validationSet.size() == 0) <END> break; } final double averageLoss = runningLoss / runningWeightOfValidationSet; logger.info("Average loss: " + averageLoss + ", runningWeight: " + runningWeightOfValidationSet); return averageLoss; }</code><technical_language>Braces required I easier read is defensive changes later. I is preferable validationSet.isEmpty() in place of validationSet.size() == 0 incase underlying set list hold size count it. In this case matter is backed arraylist if require</technical_language>

Target:
public double getCrossValidatedLoss(PredictiveModelBuilder<? extends PredictiveModel> predictiveModelBuilder, Iterable<? extends AbstractInstance> rawTrainingData) { initializeTrainingAndValidationSets(rawTrainingData); double runningLoss = 0; double runningWeightOfValidationSet = 0; while (!validationSet.isEmpty()) { PredictiveModel predictiveModel = predictiveModelBuilder.buildPredictiveModel(trainingDataToAddToPredictiveModel); runningLoss += crossValLoss.getLoss(validationSet, predictiveModel) * weightOfValidationSet; runningWeightOfValidationSet += weightOfValidationSet; logger.info("running Loss: " + runningLoss / runningWeightOfValidationSet + ", running weight: " + runningWeightOfValidationSet); updateTrainingSet(); updateCrossValidationSet(); } final double averageLoss = runningLoss / runningWeightOfValidationSet; logger.info("Average loss: " + averageLoss + ", runningWeight: " + runningWeightOfValidationSet); return averageLoss; }
Source:
<code>public boolean checkQuotaValidationForAddEdit(Quota quota, List<String> messages) { if (quota == null) { messages.add(VdcBllMessages.QUOTA_IS_NOT_VALID.toString()); return false; } <START> if (getQuotaDao().getQuotaByQuotaName(quota.getQuotaName(), quota.getStoragePoolId()) != null) { <END> messages.add(VdcBllMessages.QUOTA_NAME_ALREADY_EXISTS.toString()); return false; } if (!validateQuotaStorageLimitation(quota, messages)) { return false; } if (!validateQuotaVdsGroupLimitation(quota, messages)) { return false; } return true; }</code><technical_language>if this is called edit, this check fail</technical_language>

Target:
public boolean checkQuotaValidationForAddEdit(Quota quota, List<String> messages) { if (quota == null) { messages.add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); return false; } if (!validateQuotaStorageLimitation(quota, messages)) { return false; } if (!validateQuotaVdsGroupLimitation(quota, messages)) { return false; } return true; }
Source:
<code>public void close() throws IOException { try { reassign(Collections.emptySet()); for (final EventConsumer.LowLevelConsumer consumer : eventConsumers.values()) { consumer.close(); <START> } <END> } catch (final InvalidCursorException e) { throw new IOException(e); } }</code><technical_language>This is needed: reassign() -> onTimelinesChanged() -> electTopicRepositories() -> close</technical_language>

Target:
public void close() throws IOException { try { reassign(Collections.emptySet()); } catch (final InvalidCursorException e) { throw new IOException(e); } }
Source:
<code>public void start() { threads = Lists.newLinkedList(); delay = command.getScenarioContext().getWorkloadConfiguration().getDelay(); log.debug("Going to execute command {}.", command); <START> totalSamplesRequested = command.getScenarioContext().getWorkloadConfiguration().getSamples(); <END> samplesLeft.set(totalSamplesRequested); for (int i = 0; i < command.getThreads(); i++) { addThread(); } log.debug("Threads are scheduled"); }</code><technical_language>getSamples() -> getSamplesCount()</technical_language>

Target:
public void start() { threads = Lists.newLinkedList(); delay = command.getScenarioContext().getWorkloadConfiguration().getDelay(); log.debug("Going to execute command {}.", command); totalSamplesCountRequested = command.getScenarioContext().getWorkloadConfiguration().getSamples(); leftSamplesCount.set(totalSamplesCountRequested); for (int i = 0; i < command.getThreads(); i++) { addThread(); } log.debug("Threads are scheduled"); }
Source:
<code>public DAnalysisSelector getAnalysisSelector() { <START> return this.analysisSelector; <END> }</code><technical_language>This delegated DAnalysisSessionService. is, is a risk of inconsistent behavior: DAnalysisSelector sel1 = ...; DAnalysisSelector sel2 = ...; session.setAnalysisSelector(sel1); assertSame(sel1, session.getAnalysisSelector()); assertSame(sel1, session.getServices().getAnalysisSelector()); assertSame(session.getAnalysisSelector(), session.getServices().getAnalysisSelector()); session.getServices().setAnalysisSelector(sel2); assertSame(sel2, session.getAnalysisSelector()); // FAIL assertSame(sel1, session.getServices().getAnalysisSelector()); // PASS assertSame(session.getAnalysisSelector(), session.getServices().getAnalysisSelector()); // FAIL</technical_language>

Target:
public DAnalysisSelector getAnalysisSelector() { if (this.getServices() instanceof DAnalysisSessionService) { return ((DAnalysisSessionService) this.getServices()).getAnalysisSelector(); } return null; }
Source:
<code>public void setUp() throws IOException { Path storageBasedir = Paths.get(ConfigurationResourceResolver.getVaultDirectory() + "/storages/storage0"); generateArtifact(storageBasedir.toAbsolutePath().toString() + <START> "/org/carlspring/strongbox/strongbox-utils/8.2/strongbox-utils-8.2.jar"); <END> }</code><technical_language>This a leading slash</technical_language>

Target:
public void setUp() throws IOException { Path storageBasedir = Paths.get(ConfigurationResourceResolver.getVaultDirectory(), "storages", "storage0", "org", "carlspring", "strongbox", "strongbox-utils", "8.2", "strongbox-utils-8.2.jar"); generateArtifact(storageBasedir.toAbsolutePath().toString()); }
Source:
<code>private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { IBreakpoint newBreakpoint = null; Object[] children = container.getChildren(); for (Object <START> element2 : <END> refContainer.getChildren()) { Object element = getElement(children, element2); if (element == null) { if (element2 instanceof BreakpointContainer) { BreakpointContainer.addChildContainer(container, (BreakpointContainer) element2, containerDelta); } else if(element2 instanceof IBreakpoint) { BreakpointContainer.addBreakpoint(container, (IBreakpoint) element2, containerDelta); if (newBreakpoint == null) { newBreakpoint = (IBreakpoint) element2; } } } else if (element instanceof BreakpointContainer) { ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1); BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) element2); newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) element2, childDelta); childDelta.setChildCount(((BreakpointContainer) element).getChildren().length); } } return newBreakpoint; }</code><technical_language>rename child childElement</technical_language>

Target:
private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { IBreakpoint newBreakpoint = null; Object[] children = container.getChildren(); for (Object childElement : refContainer.getChildren()) { Object element = getElement(children, childElement); if (element == null) { if (childElement instanceof BreakpointContainer) { BreakpointContainer.addChildContainer(container, (BreakpointContainer) childElement, containerDelta); } else if(childElement instanceof IBreakpoint) { BreakpointContainer.addBreakpoint(container, (IBreakpoint) childElement, containerDelta); if (newBreakpoint == null) { newBreakpoint = (IBreakpoint) childElement; } } } else if (element instanceof BreakpointContainer) { ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1); BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) childElement); newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) childElement, childDelta); childDelta.setChildCount(((BreakpointContainer) element).getChildren().length); } } return newBreakpoint; }
Source:
<code>private void augmentRenameableTextField(){ menuBarNameArea.getChildren().removeAll(nameBox, renameButton); this.getChildren().remove(menuBarCloseButton); menuBarNameArea.getChildren().addAll(renameableTextField); menuBarNameArea.setMinWidth(NAME_AREA_EDIT_WIDTH); menuBarNameArea.setMaxWidth(NAME_AREA_EDIT_WIDTH); Tooltip.install(menuBarConfirmButton, new Tooltip("Confirm")); <START> Tooltip.install(menuBarUndoButton, new Tooltip("Undo")); <END> this.getChildren().addAll(menuBarConfirmButton, menuBarUndoButton); }</code><technical_language>Try changing tip this: "Abandon this name change previous name". Post a screenshot (I want if this tool tip is long display nicely)</technical_language>

Target:
private void augmentRenameableTextField(){ menuBarNameArea.getChildren().removeAll(nameBox, renameButton); this.getChildren().remove(menuBarCloseButton); menuBarNameArea.getChildren().addAll(renameableTextField); menuBarNameArea.setMinWidth(NAME_AREA_EDIT_WIDTH); menuBarNameArea.setMaxWidth(NAME_AREA_EDIT_WIDTH); Tooltip.install(menuBarConfirmButton, new Tooltip("Confirm this name change of the panel")); Tooltip undoTip = new Tooltip("Abandon this name change and go back to the previous name"); undoTip.setPrefWidth(TOOLTIP_WRAP_WIDTH); Tooltip.install(menuBarUndoButton, undoTip); this.getChildren().addAll(menuBarConfirmButton, menuBarUndoButton); }
Source:
<code><START> public RealMatrix getTransitionProbabilityMatrix(final int distance) { <END> final RealMatrix result = get(distance).getMatrix().copy(); result.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() { @Override public double visit(final int to, final int from, final double logProbability) { return Math.exp(logProbability); } }); return result; }</code><technical_language>This method is in test code</technical_language>

Target:
protected RealMatrix getTransitionProbabilityMatrix(final int distance) { final RealMatrix result = get(distance).getMatrix().copy(); result.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() { @Override public double visit(final int to, final int from, final double logProbability) { return Math.exp(logProbability); } }); return result; }
Source:
<code>public void assetFileValidFile() throws IOException { Realm.deleteRealm(defaultConfig); Context context = InstrumentationRegistry.getInstrumentation().getContext(); RealmConfiguration configuration = new RealmConfiguration.Builder(context, "asset_file.realm") .build(); Realm.deleteRealm(configuration); <START> <END> realm = Realm.getInstance(configuration); File realmFile = new File(configuration.getPath()); assertTrue(realmFile.exists()); assertEquals(10, realm.where(Owner.class).count()); assertEquals(10, realm.where(Cat.class).count()); realm.close(); configFactory.copyRealmFromAssets(context, "asset_file.realm", "asset_file_copy.realm"); File copyFromAsset = new File(configFactory.getRoot(), "asset_file_copy.realm"); assertTrue(copyFromAsset.exists()); assertEquals(realmFile.length(), copyFromAsset.length()); Realm.deleteRealm(configuration); assertFalse(realmFile.exists()); }</code><technical_language>Asserting file exist a good idea</technical_language>

Target:
public void assetFileValidFile() throws IOException { Context context = InstrumentationRegistry.getInstrumentation().getContext(); Realm.deleteRealm(new RealmConfiguration.Builder(context).build()); RealmConfiguration configuration = new RealmConfiguration.Builder(context).assetFile(context, "asset_file.realm") .build(); Realm.deleteRealm(configuration); File realmFile = new File(configuration.getPath()); assertFalse(realmFile.exists()); realm = Realm.getInstance(configuration); assertTrue(realmFile.exists()); assertEquals(10, realm.where(Owner.class).count()); assertEquals(10, realm.where(Cat.class).count()); realm.close(); configFactory.copyRealmFromAssets(context, "asset_file.realm", "asset_file_copy.realm"); File copyFromAsset = new File(configFactory.getRoot(), "asset_file_copy.realm"); assertTrue(copyFromAsset.exists()); Realm.deleteRealm(configuration); assertFalse(realmFile.exists()); }
Source:
<code>public static ValidationResult setAndValidateCpuProfile(VmBase vmBase, Version version) { if (!FeatureSupported.cpuQoS(version)) return ValidationResult.VALID; if (vmBase.getCpuProfileId() == null) { <START> List<CpuProfile> cpuProfiles = getCpuProfileDao().getAllForCluster(vmBase.getVdsGroupId()); if (cpuProfiles.size() > 0) { vmBase.setCpuProfileId(cpuProfiles.get(0).getId()); return ValidationResult.VALID; } else { return new ValidationResult(EngineMessage.ACTION_TYPE_CPU_PROFILE_EMPTY); } <END> } else { return new CpuProfileValidator(vmBase.getCpuProfileId()).isParentEntityValid(vmBase.getVdsGroupId()); } }</code><technical_language>assingAnyCPuProfile now, too, remove logic duplication</technical_language>

Target:
public static ValidationResult setAndValidateCpuProfile(VmBase vmBase, Version version) { if (!FeatureSupported.cpuQoS(version)) return ValidationResult.VALID; if (vmBase.getCpuProfileId() == null) { return assignFirstCpuProfile(vmBase); } else { return new CpuProfileValidator(vmBase.getCpuProfileId()).isParentEntityValid(vmBase.getVdsGroupId()); } }
Source:
<code><START> private IPath getRepositoryPath() { <END> Repository repo = null; if (repositoryMapping != null) repo = repositoryMapping.getRepository(); else if (input instanceof Repository) repo = (Repository) input; if (repo != null) new Path(repo.getWorkTree().getAbsolutePath()); return null; }</code><technical_language>move this method end of file, order of declaration corresponds createOpenAction -> getSelectedPaths -> getRepositoryPath</technical_language>

Target:
private IPath getRepositoryPath() { Repository repo = null; if (repositoryMapping != null) repo = repositoryMapping.getRepository(); else if (input instanceof Repository) repo = (Repository) input; if (repo != null) return new Path(repo.getWorkTree().getAbsolutePath()); return null; }
Source:
<code>public Job peek() throws IOException { final List<Job> jobs = this.peek(1); <START> return (null != jobs) && (jobs.size() > 0) ? jobs.get(0) : null; <END> }</code><technical_language>jobs#isEmpty instead of jobs.size() > 0</technical_language>

Target:
public Job peek() throws IOException { final List<Job> jobs = this.peek(1); return (null != jobs) && (!jobs.isEmpty()) ? jobs.get(0) : null; }
Source:
<code>public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; Change change = StoredValues.CHANGE.get(engine); Project.NameKey name = change.getProject(); <START> if (!a1.unify(SymbolTerm.intern(name.get()), engine.trail)) { <END> return engine.fail(); } return cont; }</code><technical_language>create instead</technical_language>

Target:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; Change change = StoredValues.CHANGE.get(engine); Project.NameKey name = change.getProject(); if (!a1.unify(SymbolTerm.create(name.get()), engine.trail)) { return engine.fail(); } return cont; }
Source:
<code><START> private static Map<String, Integer> calculateCRC32Partitions(File cacheDir) throws IgniteCheckedException { <END> assert cacheDir.isDirectory() : cacheDir.getAbsolutePath(); Map<String, Integer> result = new HashMap<>(); try { try (DirectoryStream<Path> partFiles = newDirectoryStream(cacheDir.toPath(), p -> p.toFile().getName().startsWith(PART_FILE_PREFIX) && p.toFile().getName().endsWith(FILE_SUFFIX)) ) { for (Path path : partFiles) result.put(path.toFile().getName(), FastCrc.calcCrc(path.toFile())); } return result; } catch (IOException e) { throw new IgniteCheckedException(e); } }</code><technical_language>Please move private method tests</technical_language>

Target:
private static Map<String, Integer> calculateCRC32Partitions(File cacheDir) { assert cacheDir.isDirectory() : cacheDir.getAbsolutePath(); Map<String, Integer> result = new HashMap<>(); try { try (DirectoryStream<Path> partFiles = newDirectoryStream(cacheDir.toPath(), p -> p.toFile().getName().startsWith(PART_FILE_PREFIX) && p.toFile().getName().endsWith(FILE_SUFFIX)) ) { for (Path path : partFiles) result.put(path.toFile().getName(), FastCrc.calcCrc(path.toFile())); } return result; } catch (IOException e) { throw new IgniteException(e); } }
Source:
<code>public static <T> T getService(Class<T> clazz, String filter, long waitTimeMillis) { Bundle bundle = FrameworkUtil.getBundle(OsgiUtil.class); checkStarted(bundle); BundleContext context = bundle.getBundleContext(); Assert.assertNotNull(context); ServiceReference<T> reference = null; int totalWaitTime = 0; do { try { Collection<ServiceReference<T>> references = context.getServiceReferences(clazz, filter); if (references != null && !references.isEmpty()) { reference = references.iterator().next(); } } catch (Exception ex) { } finally { try { if (totalWaitTime < waitTimeMillis && reference == null) { Thread.sleep(100); totalWaitTime += 100; } } catch (InterruptedException ex1) { } } } while (totalWaitTime < waitTimeMillis && reference == null); Assert.assertNotNull(String.format("Unable to find service [%s]", clazz), reference); T service = context.getService(reference); <START> System.err.println("service = "+service); <END> Assert.assertNotNull(String.format("Unable to find service instance for [%s]", clazz), service); return service; }</code><technical_language>remove debugging code</technical_language>

Target:
public static <T> T getService(Class<T> clazz, String filter, long waitTimeMillis) { Bundle bundle = FrameworkUtil.getBundle(OsgiUtil.class); checkStarted(bundle); BundleContext context = bundle.getBundleContext(); Assert.assertNotNull(context); ServiceReference<T> reference = null; int totalWaitTime = 0; do { try { Collection<ServiceReference<T>> references = context.getServiceReferences(clazz, filter); if (references != null && !references.isEmpty()) { reference = references.iterator().next(); } } catch (Exception ex) { } finally { try { if (totalWaitTime < waitTimeMillis && reference == null) { Thread.sleep(100); totalWaitTime += 100; } } catch (InterruptedException ex1) { } } } while (totalWaitTime < waitTimeMillis && reference == null); Assert.assertNotNull(String.format("Unable to find service [%s]", clazz), reference); T service = context.getService(reference); Assert.assertNotNull(String.format("Unable to find service instance for [%s]", clazz), service); return service; }
Source:
<code><START> public static void updateBurns() <END> { VANILLA_BURNS.clear(); FurnaceTileEntity.getBurnTimes().entrySet().forEach(e -> VANILLA_BURNS.put(e.getKey().delegate, e.getValue())); }</code><technical_language>Sync this, do need a server/client list in case tags synced correctly</technical_language>

Target:
public static synchronized void updateBurns() { VANILLA_BURNS.clear(); FurnaceTileEntity.getBurnTimes().entrySet().forEach(e -> VANILLA_BURNS.put(e.getKey().delegate, e.getValue())); }
Source:
<code>public void testAddMenusWithExperimentalPerspective() { when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true); List<MenuItem> items = new ArrayList<>(); items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build(); when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString())) .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0])); presenter.addMenus(menus); verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString()); verify(presenter.canHideMenuItemByIdentifier, times(3)).put(any(), any()); verify(presenter.canHideMenuItemByIdentifier.get(PERSPECTIVE_ID), times(2)).show(); <START> verify(presenter.canHideMenuItemByIdentifier.get(SECOND_PERSPECTIVE_ID), times(1)).hide(); <END> verify(presenter.canHideMenuItemByIdentifier.get(THIRD_PERSPECTIVE_ID), times(2)).show(); }</code><technical_language>more times(1)</technical_language>

Target:
public void testAddMenusWithExperimentalPerspective() { when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true); List<MenuItem> items = new ArrayList<>(); items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0)); final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build(); when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString())) .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0])); presenter.addMenus(menus); verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString()); verify(presenter.canHideMenuItemByIdentifier, times(3)).put(any(), any()); verify(presenter.canHideMenuItemByIdentifier.get(PERSPECTIVE_ID), times(2)).show(); verify(presenter.canHideMenuItemByIdentifier.get(SECOND_PERSPECTIVE_ID)).hide(); verify(presenter.canHideMenuItemByIdentifier.get(THIRD_PERSPECTIVE_ID), times(2)).show(); }
Source:
<code>public String shadow$getName() { <START> return this.translation.get(); <END> }</code><technical_language>Lazy load this instead of injecting in constructors</technical_language>

Target:
public String shadow$getName() { if (this.name == null) { this.name = shadow$getTranslation().get(); } return this.name; }
Source:
<code>public ManualCondition newInstance(StaplerRequest req, JSONObject formData) throws FormException { ManualCondition instance = new ManualCondition(); instance.users = formData.getString("users"); <START> instance.executeButtonLabel = instance.getExecuteButtonLabel(); <END> instance.parameterDefinitions = Descriptor.newInstancesFromHeteroList(req, formData, "parameters", ParameterDefinition.all()); return instance; }</code><technical_language>Unused field</technical_language>

Target:
public ManualCondition newInstance(StaplerRequest req, JSONObject formData) throws FormException { ManualCondition instance = new ManualCondition(); instance.users = formData.getString("users"); instance.parameterDefinitions = Descriptor.newInstancesFromHeteroList(req, formData, "parameters", ParameterDefinition.all()); return instance; }
Source:
<code>private static void assertCompositeEqualPredicate(CompositeEqualPredicate expected, Predicate actual) { assertTrue(actual instanceof CompositeEqualPredicate); CompositeEqualPredicate actualEqualPredicate = (CompositeEqualPredicate) actual; assertEquals(expected.indexName, actualEqualPredicate.indexName); <START> assertEquals(expected.components, actualEqualPredicate.components); <END> assertEquals(expected.value, actualEqualPredicate.value); }</code><technical_language>I miss something, assertEquals for arrays is marked deprecated assertArrayEquals is recommended replacement</technical_language>

Target:
private static void assertCompositeEqualPredicate(CompositeEqualPredicate expected, Predicate actual) { assertTrue(actual instanceof CompositeEqualPredicate); CompositeEqualPredicate actualEqualPredicate = (CompositeEqualPredicate) actual; assertEquals(expected.indexName, actualEqualPredicate.indexName); assertArrayEquals(expected.components, actualEqualPredicate.components); assertEquals(expected.value, actualEqualPredicate.value); }
Source:
<code>private List<ConnectionType> getAllInputMainConnectors(NodeType nodeType) { List<ConnectionType> allInputConnectors = ComponentUtilities.getNodeInputConnections(nodeType); Iterator<ConnectionType> connectionIter = allInputConnectors.iterator(); while (connectionIter.hasNext()) { ConnectionType nextConnector = connectionIter.next(); <START> if (!nextConnector.getConnectorName().equals("FLOW")) { <END> connectionIter.remove(); } } return allInputConnectors; }</code><technical_language>"FLOW".equals(...)</technical_language>

Target:
private List<ConnectionType> getAllInputMainConnectors(NodeType nodeType) { List<ConnectionType> allInputConnectors = ComponentUtilities.getNodeInputConnections(nodeType); Iterator<ConnectionType> connectionIter = allInputConnectors.iterator(); while (connectionIter.hasNext()) { ConnectionType nextConnector = connectionIter.next(); if (!"FLOW".equals(nextConnector.getConnectorName())) { connectionIter.remove(); } } return allInputConnectors; }
Source:
<code>private void initOrgUnitFragment(OrgUnit orgUnit) { <START> LinearLayout changeLayout = (LinearLayout) findViewById(R.id.dashboard_planning_init); <END> changeLayout.setVisibility(View.GONE); changeLayout = (LinearLayout) findViewById(R.id.dashboard_planning_orgunit); changeLayout.setVisibility(View.VISIBLE); plannedOrgUnitsFragment = new PlannedPerOrgUnitFragment(); plannedOrgUnitsFragment.setArguments(getIntent().getExtras()); replaceListFragment(R.id.dashboard_planning_orgunit, plannedOrgUnitsFragment); plannedOrgUnitsFragment.reloadData(); }</code><technical_language>@idelcano is here? a lines. crazy merge :)</technical_language>

Target:
private void initOrgUnitFragment(OrgUnit orgUnit) { findViewById(R.id.dashboard_planning_init).setVisibility(View.GONE); findViewById(R.id.dashboard_planning_orgunit).setVisibility(View.VISIBLE); plannedOrgUnitsFragment = new PlannedPerOrgUnitFragment(); plannedOrgUnitsFragment.setArguments(getIntent().getExtras()); replaceListFragment(R.id.dashboard_planning_orgunit, plannedOrgUnitsFragment); plannedOrgUnitsFragment.reloadData(); }
Source:
<code>public void exportStats() throws Exception { List<Stat> stats = getStats(); if (mConfig.getProgressMonitorAsJson()) { System.out.println(JSONArray.toJSONString(stats)); } else { for (Stat stat : stats) { exportToTsdb(stat.getMetric(), stat.getTags(), stat.getValue()); } } <START> <END> }</code><technical_language>Remove blank line</technical_language>

Target:
public void exportStats() throws Exception { List<Stat> stats = getStats(); System.out.println(JSONArray.toJSONString(stats)); if (mConfig.getTsdbHostport() != null && !mConfig.getTsdbHostport().isEmpty()) { for (Stat stat : stats) { exportToTsdb(stat); } } }
Source:
<code>protected void displayCardAnswer() { Timber.d("displayCardAnswer()"); <START> crashWebViewRenderer(); <END> if (mCurrentCard == null) { return; } if (typeAnswer()) { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(mAnswerField.getWindowToken(), 0); } sDisplayAnswer = true; String answer = mCurrentCard.a(); mSoundPlayer.stopSounds(); answer = getCol().getMedia().escapeImages(answer); mAnswerField.setVisibility(View.GONE); String userAnswer; if (mUseInputTag) { userAnswer = cleanTypedAnswer(mTypeInput); } else { userAnswer = cleanTypedAnswer(mAnswerField.getText().toString()); } String correctAnswer = cleanCorrectAnswer(mTypeCorrect); Timber.d("correct answer = %s", correctAnswer); Timber.d("user answer = %s", userAnswer); answer = typeAnsAnswerFilter(answer, userAnswer, correctAnswer); mIsSelecting = false; updateCard(enrichWithQADiv(answer, true)); showEaseButtons(); if (mUseTimer) { long delay = mWaitQuestionSecond * 1000 + mUseTimerDynamicMS; if (delay > 0) { mTimeoutHandler.removeCallbacks(mShowQuestionTask); mTimeoutHandler.postDelayed(mShowQuestionTask, delay); } } }</code><technical_language>intend for this line remain here? crash time showed answer, is for local testing</technical_language>

Target:
protected void displayCardAnswer() { Timber.d("displayCardAnswer()"); if (mCurrentCard == null) { return; } if (typeAnswer()) { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(mAnswerField.getWindowToken(), 0); } sDisplayAnswer = true; String answer = mCurrentCard.a(); mSoundPlayer.stopSounds(); answer = getCol().getMedia().escapeImages(answer); mAnswerField.setVisibility(View.GONE); String userAnswer; if (mUseInputTag) { userAnswer = cleanTypedAnswer(mTypeInput); } else { userAnswer = cleanTypedAnswer(mAnswerField.getText().toString()); } String correctAnswer = cleanCorrectAnswer(mTypeCorrect); Timber.d("correct answer = %s", correctAnswer); Timber.d("user answer = %s", userAnswer); answer = typeAnsAnswerFilter(answer, userAnswer, correctAnswer); mIsSelecting = false; updateCard(enrichWithQADiv(answer, true)); showEaseButtons(); if (mUseTimer) { long delay = mWaitQuestionSecond * 1000 + mUseTimerDynamicMS; if (delay > 0) { mTimeoutHandler.removeCallbacks(mShowQuestionTask); mTimeoutHandler.postDelayed(mShowQuestionTask, delay); } } }
Source:
<code><START> public synchronized void startMigration(final String operationId, <END> final String senderId, final String receiverId, final String dataType, final Set<LongRange> ranges, final TraceInfo traceInfo) { if (ongoingMigrations.containsKey(operationId)) { notifyFailure(operationId, "Already registered id : " + operationId); } else { ongoingMigrations.put(operationId, new MigrationInfo(senderId, receiverId, dataType)); sender.get().sendCtrlMsg(senderId, dataType, receiverId, ranges, operationId, traceInfo); } }</code><technical_language>of methods synchronized. point of ConcurrentMap, then</technical_language>

Target:
public synchronized void startMigration(final String operationId, final String senderId, final String receiverId, final String dataType, final Set<LongRange> ranges, final TraceInfo traceInfo) { if (ongoingMigrations.containsKey(operationId)) { LOG.log(Level.WARNING, "Failed to register migration with id {0}. Already exists", operationId); return; } if (!partitionManager.checkRanges(senderId, dataType, ranges)) { final String reason = new StringBuilder() .append("The requested ranges are not movable from ").append(senderId) .append(" of type ").append(dataType) .append(". Requested ranges: ").append(Arrays.toString(ranges.toArray())) .toString(); notifyFailure(operationId, reason); return; } ongoingMigrations.put(operationId, new Migration(senderId, receiverId, dataType)); sender.get().sendCtrlMsg(senderId, dataType, receiverId, ranges, operationId, traceInfo); }
Source:
<code>public void check(ThrowingRunnable assertion) { try { assertion.run(); } catch (AssertionError error) { proxies.collectError(error); } catch (Exception e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>nice catch runtime rethrow is instead wrapping in in another runtime</technical_language>

Target:
public void check(ThrowingRunnable assertion) throws Exception { try { assertion.run(); } catch (AssertionError error) { proxies.collectError(error); } }
Source:
<code>public void forceLedgerComplete(int rc, long ledgerId, BookieSocketAddress addr, Object ctx) { int bookieIndex = (Integer) ctx; if (completed) { return; } if (BKException.Code.OK != rc) { lastSeenError = rc; } receivedResponseSet.clear(bookieIndex); if (rc == BKException.Code.OK) { if (ackSet.completeBookieAndCheck(bookieIndex) && !completed) { completed = true; <START> LOG.debug("After force on ledger updating LastAddConfirmed to ", <END> ledgerId, currentNonDurableLastAddConfirmed); lh.lastAddConfirmed = currentNonDurableLastAddConfirmed; FutureUtils.complete(cb, null); return; } } else { LOG.warn("ForceLedger did not succeed: Ledger on {}", new Object[]{ledgerId, addr}); } if (receivedResponseSet.isEmpty()) { completed = true; FutureUtils.completeExceptionally(cb, BKException.create(lastSeenError)); } }</code><technical_language>if (LOG.isDebugEnabled())</technical_language>

Target:
public void forceLedgerComplete(int rc, long ledgerId, BookieSocketAddress addr, Object ctx) { int bookieIndex = (Integer) ctx; checkState(!completed, "We are waiting for all the bookies, it is not expected an early exit"); if (errored) { return; } if (BKException.Code.OK != rc) { lastSeenError = rc; } if (rc == BKException.Code.OK) { if (ackSet.completeBookieAndCheck(bookieIndex)) { completed = true; if (LOG.isDebugEnabled()) { LOG.debug("After force on ledger updating LastAddConfirmed to ", ledgerId, currentNonDurableLastAddConfirmed); } lh.updateLastConfirmed(currentNonDurableLastAddConfirmed, lh.getLength()); FutureUtils.complete(cb, null); } } else { LOG.info("ForceLedger did not succeed: Ledger on {}", ledgerId, addr); errored = true; FutureUtils.completeExceptionally(cb, BKException.create(lastSeenError)); } }
Source:
<code>public void delete() { if (this.configurableComponent.isFactoryComponent()) { EntryClassUi.showWaitModal(); this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() { @Override public void onFailure(Throwable ex) { EntryClassUi.hideWaitModal(); FailureHandler.handle(ex); } @Override public void onSuccess(GwtXSRFToken token) { ServicesUi.this.gwtComponentService.deleteFactoryConfiguration(token, ServicesUi.this.configurableComponent.getComponentId(), true, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { EntryClassUi.hideWaitModal(); errorLogger.log(Level.SEVERE, caught.getLocalizedMessage()); } @Override public void onSuccess(Void result) { ServicesUi.this.deleteModal.hide(); ServicesUi.this.apply.setEnabled(false); ServicesUi.this.reset.setEnabled(false); setDirty(false); ServicesUi.this.entryClass.fetchAvailableServices(null); EntryClassUi.hideWaitModal(); <START> Window.Location.reload(); <END> } }); } }); } }</code><technical_language>want refresh entire page, I safely clear body of onSuccess() callback here, leaving Window.Location.reload() it. This spare a couple of RPC calls performed fetchAvailableServices()</technical_language>

Target:
public void delete() { if (this.configurableComponent.isFactoryComponent()) { EntryClassUi.showWaitModal(); this.gwtXSRFService.generateSecurityToken(new AsyncCallback<GwtXSRFToken>() { @Override public void onFailure(Throwable ex) { EntryClassUi.hideWaitModal(); FailureHandler.handle(ex); } @Override public void onSuccess(GwtXSRFToken token) { ServicesUi.this.gwtComponentService.deleteFactoryConfiguration(token, ServicesUi.this.configurableComponent.getComponentId(), true, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { EntryClassUi.hideWaitModal(); errorLogger.log(Level.SEVERE, caught.getLocalizedMessage()); } @Override public void onSuccess(Void result) { Window.Location.reload(); } }); } }); } }
Source:
<code>private ResponseEntity postEventInternal(final String eventTypeName, final String eventsAsString, final NativeWebRequest nativeWebRequest, final EventTypeMetrics eventTypeMetrics, final Client client) { final long startingNanos = System.nanoTime(); try { final JSONArray eventsAsJsonObjects = new JSONArray(eventsAsString); final int eventCount = eventsAsJsonObjects.length(); <START> eventTypeMetrics.reportSizing(eventCount, eventsAsString.getBytes(Charsets.UTF_8).length); <END> return response(publisher.publish(eventsAsJsonObjects, eventTypeName, client)); } catch (final JSONException e) { LOG.debug("Problem parsing event", e); return processJSONException(e, nativeWebRequest); } catch (final NoSuchEventTypeException e) { LOG.debug("Event type not found.", e); return create(e.asProblem(), nativeWebRequest); } catch (final NakadiException e) { LOG.debug("Failed to publish batch", e); return create(e.asProblem(), nativeWebRequest); } finally { eventTypeMetrics.updateTiming(startingNanos, System.nanoTime()); } }</code><technical_language>@lmontrieux validation I problem. related fix, fix works pretty good. is update statistics publishing of events. events rejected of validation problem include event sizes metrics. for sense include statistics events published. do think</technical_language>

Target:
private ResponseEntity postEventInternal(final String eventTypeName, final String eventsAsString, final NativeWebRequest nativeWebRequest, final EventTypeMetrics eventTypeMetrics, final Client client) { final long startingNanos = System.nanoTime(); try { final JSONArray eventsAsJsonObjects = new JSONArray(eventsAsString); final int eventCount = eventsAsJsonObjects.length(); final EventPublishResult result = publisher.publish(eventsAsJsonObjects, eventTypeName, client); reportMetrics(eventTypeMetrics, result, eventsAsString, eventCount); final ResponseEntity response = response(result); return response; } catch (final JSONException e) { LOG.debug("Problem parsing event", e); return processJSONException(e, nativeWebRequest); } catch (final NoSuchEventTypeException e) { LOG.debug("Event type not found.", e); return create(e.asProblem(), nativeWebRequest); } catch (final NakadiException e) { LOG.debug("Failed to publish batch", e); return create(e.asProblem(), nativeWebRequest); } finally { eventTypeMetrics.updateTiming(startingNanos, System.nanoTime()); } }
Source:
<code>public XmlUserManager(final Props props) { this.xmlPath = props.getString(XML_FILE_PARAM); parseXMLFile(); Runnable runnable = () -> { WatchService watchService; Path path; try { watchService = FileSystems.getDefault().newWatchService(); final File file = new File(this.xmlPath); final String dirPath = file.getParent(); path = Paths.get(dirPath); path.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE); } catch (IOException e) { <START> logger.warn("IOException while setting up watch on conf" <END> + e.getMessage()); return; } for (;;) { WatchKey watchKey; try { watchKey = watchService.take(); } catch (InterruptedException ie) { logger.warn(ie.getMessage()); return; } for (WatchEvent<?> event : watchKey.pollEvents()) { @SuppressWarnings("unchecked") final Path name = ((WatchEvent<Path>)event).context(); final Path child = path.resolve(name); if (!child.toString().equals(this.xmlPath)) { continue; } logger.info("Modification detected, reloading user config"); parseXMLFile(); } watchKey.reset(); } }; final Thread thread = new Thread(runnable); System.out.println("Starting thread"); thread.start(); }</code><technical_language>Is reason alert administrators right in a is harder miss</technical_language>

Target:
public XmlUserManager(final Props props) { this.xmlPath = props.getString(XML_FILE_PARAM); parseXMLFile(); Map<String, ParseConfigFile> parseConfigFileMap = new HashMap<>(); parseConfigFileMap.put(this.xmlPath, this::parseXMLFile); UserUtils.setupWatch(parseConfigFileMap); }
Source:
<code>public void testMinGapIsEnforcedForASyncChecks() throws Exception { <START> final List<FsVolumeSpi> volumes = <END> TestDatasetVolumeChecker.makeVolumes(1, VolumeCheckResult.HEALTHY); final FsDatasetSpi<FsVolumeSpi> dataset = TestDatasetVolumeChecker.makeDataset(volumes); final FakeTimer timer = new FakeTimer(); final Configuration conf = new HdfsConfiguration(); final long minGapMs = 100; conf.setTimeDuration(DFSConfigKeys.DFS_DATANODE_DISK_CHECK_MIN_GAP_KEY, minGapMs, TimeUnit.MILLISECONDS); final DatasetVolumeChecker checker = new DatasetVolumeChecker(conf, timer); checker.checkAllVolumesAsync(dataset, null); assertThat(checker.getNumAsyncDatasetChecks(), is(1L)); checker.checkAllVolumesAsync(dataset, null); assertThat(checker.getNumAsyncDatasetChecks(), is(1L)); assertThat(checker.getNumSkippedChecks(), is(1L)); timer.advance(minGapMs); checker.checkAllVolumesAsync(dataset, null); assertThat(checker.getNumAsyncDatasetChecks(), is(2L)); assertThat(checker.getNumSkippedChecks(), is(1L)); }</code><technical_language>NIT: wrap common test prep code a helper for testMinGapIsEnforcedForSyncChecks() testMinGapIsEnforcedForASyncChecks()</technical_language>

Target:
public void testMinGapIsEnforcedForASyncChecks() throws Exception { final List<FsVolumeSpi> volumes = TestDatasetVolumeChecker.makeVolumes(1, VolumeCheckResult.HEALTHY); final FsDatasetSpi<FsVolumeSpi> dataset = TestDatasetVolumeChecker.makeDataset(volumes); final DatasetVolumeChecker checker = new DatasetVolumeChecker(conf, timer); checker.checkAllVolumesAsync(dataset, null); assertThat(checker.getNumAsyncDatasetChecks(), is(1L)); checker.checkAllVolumesAsync(dataset, null); assertThat(checker.getNumAsyncDatasetChecks(), is(1L)); assertThat(checker.getNumSkippedChecks(), is(1L)); timer.advance(MIN_DISK_CHECK_GAP_MS); checker.checkAllVolumesAsync(dataset, null); assertThat(checker.getNumAsyncDatasetChecks(), is(2L)); assertThat(checker.getNumSkippedChecks(), is(1L)); }
Source:
<code>private Optional<VirtualMachineCustomImage> handleCustomImageCreationException(AzureImageInfo azureImageInfo, AuthenticatedContext ac, AzureClient client, AzureManagedImageCreationCheckerContext checkerContext, CloudException originalException) { Optional<VirtualMachineCustomImage> customImage; Optional<Throwable> errorResult = azureManagedImageCreationPoller.startPolling(ac, checkerContext, false); customImage = findImage(azureImageInfo, client); if (customImage.isEmpty()) { updateImageStatus(ac, azureImageInfo.getImageNameWithRegion(), azureImageInfo.getImageId(), CommonStatus.FAILED); <START> if (errorResult.isPresent() && !(errorResult.get() instanceof TimeoutException)) { <END> LOGGER.error("Failed to create custom image: ", errorResult.get()); throw new CloudConnectorException(errorResult.get()); } LOGGER.error("Failed to create custom image: ", originalException); throw new CloudConnectorException(originalException); } return customImage; }</code><technical_language>is a reason decided catch TimeoutException in a try... catch here</technical_language>

Target:
private Optional<VirtualMachineCustomImage> handleCustomImageCreationException(AzureImageInfo azureImageInfo, AuthenticatedContext ac, AzureClient client, AzureManagedImageCreationCheckerContext checkerContext, CloudException originalException) { Exception onError = originalException; try { azureManagedImageCreationPoller.startPolling(ac, checkerContext); } catch (TimeoutException e) { LOGGER.warn("Timeout during polling for image creation: ", e); } catch (Exception e) { LOGGER.warn("Exception during polling for image creation: ", e); onError = e; } finally { Optional<VirtualMachineCustomImage> customImage; customImage = findImage(azureImageInfo, client); if (customImage.isEmpty()) { updateImageStatus(ac, azureImageInfo.getImageNameWithRegion(), azureImageInfo.getImageId(), CommonStatus.FAILED); LOGGER.error("Failed to create custom image, throwing: ", onError); throw new CloudConnectorException(onError); } return customImage; } }
Source:
<code>public static void main(String[] args) { try { JNISetup.setupJNI(); } catch (NoSuchFieldException e1) { e1.printStackTrace(); } catch (SecurityException e1) { e1.printStackTrace(); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } List<String> ports = getAvailablePorts(); System.out.println(ports); Robot.getInstance(); Gui.getInstance(); if (RobobuggyConfigFile.DATA_PLAY_BACK) { <START> final SensorPlayer sp = new SensorPlayer("logs/sensor.txt"); <END> new Thread(new Runnable() { @Override public void run() { sp.run(); } }).start(); } else { Robot.getInstance().startNodes(); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } new RobobuggyLogicNotification("Robobuggy Logic Notfication started", RobobuggyMessageLevel.NOTE); } }</code><technical_language>do wanted changed sensor.txt</technical_language>

Target:
public static void main(String[] args) { try { JNISetup.setupJNI(); } catch (NoSuchFieldException e1) { e1.printStackTrace(); } catch (SecurityException e1) { e1.printStackTrace(); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } List<String> ports = getAvailablePorts(); System.out.println(ports); Robot.getInstance(); Gui.getInstance(); if (RobobuggyConfigFile.DATA_PLAY_BACK) { final SensorPlayer sp = new SensorPlayer("logs/sensors_2016-02-05-20-03-47.txt"); new Thread(new Runnable() { @Override public void run() { sp.run(); } }).start(); } else { Robot.getInstance().startNodes(); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } new RobobuggyLogicNotification("Robobuggy Logic Notfication started", RobobuggyMessageLevel.NOTE); } }
Source:
<code>public Comparator<DoublesSketch> getComparator() { <START> return new Comparator<DoublesSketch>() <END> { @Override public int compare(final DoublesSketch a, final DoublesSketch b) { return Long.compare(a.getN(), b.getN()); } }; }</code><technical_language>I Comparator.nullsFirst(Comparator.comparingLong(DoublesSketch::getN)). Also, please cache in a constant field</technical_language>

Target:
public Comparator<DoublesSketch> getComparator() { return DoublesSketchAggregatorFactory.COMPARATOR; }