auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void getObs_ShouldPopulateModelAndViewWitDicomViewerUrlForCompletedStudyAndObsForGivenObsAndGivenValidOrder() throws Exception { mockStudy.setPerformedStatus(PerformedProcedureStepStatus.COMPLETED); when(Utils.serversAddress()).thenReturn("localhost"); when(Utils.serversPort()).thenReturn("8081"); when(Utils.dicomViewerUrlBase()).thenReturn("/oviyam2/viewer.html?"); when(Utils.dicomViewerLocalServerName()).thenReturn("oviyamlocal"); ModelAndView modelAndView = radiologyObsFormController.getObs(validorderId, validObsIdForOrder20); assertNotNull(modelAndView); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); assertTrue(modelAndView.getModelMap().containsKey("dicomViewerUrl")); String dicomViewerUrl = (String) modelAndView.getModelMap().get("dicomViewerUrl"); assertNotNull(dicomViewerUrl); String patID = mockOrder.getPatient().getPatientIdentifier().getIdentifier(); assertTrue(dicomViewerUrl.equals("http://localhost:8081/oviyam2/viewer.html?serverName=oviyamlocal&studyUID=" <START> + mockStudy.getStudyInstanceUid() + "&patientID=" + patID)); <END> }</code><technical_language>write test for jnlp? check if patientID is appended correctly URL</technical_language>

Target:
public void getObs_ShouldPopulateModelAndViewWitDicomViewerUrlForCompletedStudyAndObsForGivenObsAndGivenValidOrder() throws Exception { mockStudy.setPerformedStatus(PerformedProcedureStepStatus.COMPLETED); when(Utils.serversAddress()).thenReturn("localhost"); when(Utils.serversPort()).thenReturn("8081"); when(Utils.dicomViewerUrlBase()).thenReturn("/weasis-pacs-connector/viewer?"); when(Utils.dicomViewerLocalServerName()).thenReturn(""); when(Utils.dicomViewerUrl()).thenReturn("http://localhost:8081/weasis-pacs-connector/viewer?"); ModelAndView modelAndView = radiologyObsFormController.getObs(validorderId, validObsIdForOrder20); assertNotNull(modelAndView); assertThat(modelAndView.getViewName(), is("module/radiology/radiologyObsForm")); assertTrue(modelAndView.getModelMap().containsKey("dicomViewerUrl")); String dicomViewerUrl = (String) modelAndView.getModelMap().get("dicomViewerUrl"); assertNotNull(dicomViewerUrl); String patID = mockOrder.getPatient().getPatientIdentifier().getIdentifier(); System.out.println("dicomViewerUrl: " + dicomViewerUrl); System.out.println("Utils.dicomViewerUrl(): " + Utils.dicomViewerUrl()); assertTrue(dicomViewerUrl.equals("http://localhost:8081/weasis-pacs-connector/viewer?studyUID=" + mockStudy.getStudyInstanceUid() + "&patientID=" + patID)); }
Source:
<code>private void touchFeatures() { FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); IFeatureModel[] workspaceFeatures = manager.getWorkspaceModels(); if (workspaceFeatures.length > 0) { IProgressMonitor monitor = new NullProgressMonitor(); SubMonitor subMonitor = SubMonitor.convert(monitor, workspaceFeatures.length); for (int i = 0; i < workspaceFeatures.length; i++) { try { IResource resource = workspaceFeatures[i].getUnderlyingResource(); if (resource != null) { <START> resource.touch(subMonitor.newChild(1)); <END> } else { monitor.worked(1); } } catch (CoreException e) { } } } fTouchFeatures = false; }</code><technical_language>Suggest requesting child monitor unconditionally start of for loop. need "else" branch: for (int i = 0; i < ...) { SubMonitor iterationMonitor = subMonitor.newChild(1); if (foo) { resource.touch(iterationMonitor); } }</technical_language>

Target:
private void touchFeatures() { FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); IFeatureModel[] workspaceFeatures = manager.getWorkspaceModels(); if (workspaceFeatures.length > 0) { IProgressMonitor monitor = new NullProgressMonitor(); SubMonitor subMonitor = SubMonitor.convert(monitor, workspaceFeatures.length); for (int i = 0; i < workspaceFeatures.length; i++) { SubMonitor iterationMonitor = subMonitor.newChild(1); try { IResource resource = workspaceFeatures[i].getUnderlyingResource(); if (resource != null) { resource.touch(iterationMonitor); } } catch (CoreException e) { PDECore.log(e); } } } fTouchFeatures = false; }
Source:
<code>public void setChannelName(String channelName) { super.setReceiver(channelName); this.channelName = channelName; channelTabRoot.setId(channelName); channelTabRoot.setText(channelName); userSearchTextField.setPromptText(i18n.get("chat.userCount", chatService.getChatUsersForChannel(channelName).size())); chatService.getChatUsersForChannel(channelName).addListener((MapChangeListener<? super String, ? super ChatUser>) change -> { Platform.runLater(() -> userSearchTextField.setPromptText(i18n.get("chat.userCount", change.getMap().size()))); }); <START> <END> chatService.addChannelUserListListener(channelName, change -> { if (change.wasAdded()) { onUserJoinedChannel(change.getValueAdded()); } else if (change.wasRemoved()) { onUserLeft(change.getValueRemoved().getUsername()); } }); ConcurrentUtil.executeInBackground(new Task<Void>() { @Override protected Void call() throws Exception { ObservableMap<String, ChatUser> chatUsersForChannel = chatService.getChatUsersForChannel(channelName); synchronized (chatUsersForChannel) { chatUsersForChannel.values().forEach(ChannelTabController.this::onUserJoinedChannel); } return null; } }); channelTabRoot.setOnCloseRequest(event -> chatService.leaveChannel(channelName)); }</code><technical_language>In JavaFX, ChangeListener interested element(s) added removed, InvalidationListener if need updated</technical_language>

Target:
public void setChannelName(String channelName) { super.setReceiver(channelName); this.channelName = channelName; channelTabRoot.setId(channelName); channelTabRoot.setText(channelName); userSearchTextField.setPromptText(i18n.get("chat.userCount", chatService.getChatUsersForChannel(channelName).size())); chatService.getChatUsersForChannel(channelName).addListener((InvalidationListener) change -> { Platform.runLater(() -> userSearchTextField.setPromptText(i18n.get("chat.userCount", chatService.getChatUsersForChannel(channelName).size()))); }); chatService.addChannelUserListListener(channelName, change -> { if (change.wasAdded()) { onUserJoinedChannel(change.getValueAdded()); } else if (change.wasRemoved()) { onUserLeft(change.getValueRemoved().getUsername()); } }); ConcurrentUtil.executeInBackground(new Task<Void>() { @Override protected Void call() throws Exception { ObservableMap<String, ChatUser> chatUsersForChannel = chatService.getChatUsersForChannel(channelName); synchronized (chatUsersForChannel) { chatUsersForChannel.values().forEach(ChannelTabController.this::onUserJoinedChannel); } return null; } }); channelTabRoot.setOnCloseRequest(event -> chatService.leaveChannel(channelName)); }
Source:
<code>private void retrieveFiles() { displayLoading(); URL googleDriveURL = null; try { googleDriveURL = new URL("<LINK_0>"); } catch (MalformedURLException e) { e.printStackTrace(); } GsonResponseParser gsonResponseParser = new GsonResponseParser(); gsonResponseParser.getMarshallingConfig().setDataRoot("items"); PipeManager.config("files", RestfulPipeConfiguration.class) .withUrl(googleDriveURL) .module(authzModule) .responseParser(gsonResponseParser) .forClass(Files.class); @SuppressWarnings("unchecked") Pipe<Files> documentsPipe = PipeManager.getPipe("files", this); documentsPipe.read(new Callback<List<Files>>() { @Override public void onSuccess(final List<Files> fileses) { Toast.makeText(getApplicationContext(), <START> getResources().getQuantityString(R.plurals.fetched, fileses.size()), <END> Toast.LENGTH_LONG).show(); displayDriveFiles(fileses); } @Override public void onFailure(Exception e) { Log.e("EXCEPTION", e.getMessage(), e); Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } }); }</code><technical_language>getResources().getQuantityString(R.plurals.fetched, fileses.size() , fileses.size()) replace %d actual number of files</technical_language>

Target:
private void retrieveFiles() { displayLoading(); URL googleDriveURL = null; try { googleDriveURL = new URL("<LINK_0>"); } catch (MalformedURLException e) { e.printStackTrace(); } GsonResponseParser gsonResponseParser = new GsonResponseParser(); gsonResponseParser.getMarshallingConfig().setDataRoot("items"); PipeManager.config("files", RestfulPipeConfiguration.class) .withUrl(googleDriveURL) .module(authzModule) .responseParser(gsonResponseParser) .forClass(Files.class); @SuppressWarnings("unchecked") Pipe<Files> documentsPipe = PipeManager.getPipe("files", this); documentsPipe.read(new Callback<List<Files>>() { @Override public void onSuccess(final List<Files> fileses) { Toast.makeText(getApplicationContext(), getResources().getQuantityString(R.plurals.fetched, fileses.size() , fileses.size()), Toast.LENGTH_LONG).show(); displayDriveFiles(fileses); } @Override public void onFailure(Exception e) { Log.e("EXCEPTION", e.getMessage(), e); Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } }); }
Source:
<code>public MenuItem build() { <START> final DropDownMenus.Builder menuBuilder = new DropDownMenus.Builder().addStyleName("pull-right"); <END> for (final MenuDevCommand command : devCommands) { menuBuilder.add(new AnchorListItems.Builder(command.getText()) .setIcon(command.getIcon()) .addClickHandler(event -> command.execute()) .build()); } final IsWidget group = new ButtonGroups.Builder() .add(new Buttons.Builder() .setToggleCaret(false) .setDataToggle(Toggle.DROPDOWN) .setIcon(IconType.COG) .setSize(ButtonSize.SMALL) .setTitle("Development") .build()) .add(menuBuilder.build()) .build(); return MenuUtils.buildItem(group); }</code><technical_language>I finished initialization of DropDownMenu final DropDownMenu menu = new DropDownMenus.Builder().addStyleName("pull-right").build(); instead of .add(menuBuilder.build()) in lines I done .add(menu) . I more clear in this case. a personal preference</technical_language>

Target:
public MenuItem build() { final DropDownMenu menu = new DropDownMenus.Builder().addStyleName("pull-right").build(); for (final MenuDevCommand command : devCommands) { menu.add(new AnchorListItems.Builder(command.getText()) .setIcon(command.getIcon()) .addClickHandler(event -> command.execute()).build() ); } final IsWidget group = new ButtonGroups.Builder() .add(new Buttons.Builder() .setToggleCaret(false) .setDataToggle(Toggle.DROPDOWN) .setIcon(IconType.COG) .setSize(ButtonSize.SMALL) .setTitle("Development").build()) .add(menu).build(); return MenuUtils.buildItem(group); }
Source:
<code>public void saveOrUpdateDetailsInBatch(List<GlusterGeoRepSessionDetails> geoRepSessionDetailsObjs) { List<GlusterGeoRepSessionDetails> insertList = new ArrayList<>(); List<GlusterGeoRepSessionDetails> updateList = new ArrayList<>(); for (GlusterGeoRepSessionDetails details : geoRepSessionDetailsObjs) <START> if (getGeoRepSessionDetails(details.getSessionId(), details.getMasterBrickId()) == null) <END> insertList.add(details); else updateList.add(details); saveDetailsInBatch(insertList); updateDetailsInBatch(updateList); }</code><technical_language>Apply default formatter</technical_language>

Target:
public void saveOrUpdateDetailsInBatch(List<GlusterGeoRepSessionDetails> geoRepSessionDetailsObjs) { List<GlusterGeoRepSessionDetails> insertList = new ArrayList<>(); List<GlusterGeoRepSessionDetails> updateList = new ArrayList<>(); for (GlusterGeoRepSessionDetails details : geoRepSessionDetailsObjs) { if (getGeoRepSessionDetails(details.getSessionId(), details.getMasterBrickId()) == null) { insertList.add(details); } else { updateList.add(details); } } saveDetailsInBatch(insertList); updateDetailsInBatch(updateList); }
Source:
<code>private List<AffinityGroup> mapAffinityGroups(Map<String, String> affinityGroupMap, List<AffinityGroup> affinityGroupsFromParam, Guid vmId) { List<AffinityGroup> affinityGroups = new ArrayList<>(); if (affinityGroupsFromParam == null) { return Collections.emptyList(); <START> } <END> affinityGroupsFromParam.forEach(affinityGroup -> { log.info("Mapping affinity group '{}/{} for vm '{}'.", affinityGroup.getId(), affinityGroup.getName(), vmId); AffinityGroup affGroup = getRelatedEntity(affinityGroupMap, affinityGroup.getName(), val -> affinityGroupDao.getByName((String) val)); if (affGroup != null) { affinityGroups.add(affGroup); } }); return affinityGroups; }</code><technical_language>I move #163 afterwards, compiler optimize</technical_language>

Target:
private List<AffinityGroup> mapAffinityGroups(Map<String, String> affinityGroupMap, List<AffinityGroup> affinityGroupsFromParam, Guid vmId) { if (affinityGroupsFromParam == null) { return Collections.emptyList(); } List<AffinityGroup> affinityGroups = new ArrayList<>(); affinityGroupsFromParam.forEach(affinityGroup -> { log.info("Mapping affinity group '{}/{} for vm '{}'.", affinityGroup.getId(), affinityGroup.getName(), vmId); AffinityGroup affGroup = getRelatedEntity(affinityGroupMap, affinityGroup.getName(), val -> affinityGroupDao.getByName((String) val)); if (affGroup != null) { affinityGroups.add(affGroup); } }); return affinityGroups; }
Source:
<code>protected ByteBuffer filterChunkToRange(ByteBuffer buf) { if (options.getBlobOptions.getRange() == null) { <START> return buf; <END> } if (resolvedByteRange.getRangeSize() == 0) { buf.position(0); buf.limit(0); } else { long startOffsetInThisChunk = chunkIndex == 0 ? resolvedByteRange.getStartOffset() - offset : 0; long endOffsetInThisChunk = chunkIndex == (numChunksTotal - 1) ? resolvedByteRange.getEndOffset() - offset + 1 : chunkSize; buf.position((int) startOffsetInThisChunk); buf.limit((int) endOffsetInThisChunk); } return buf.slice(); }</code><technical_language>I previously if chunkIndex > 0, startOffsetInThisChunk is 0 here</technical_language>

Target:
protected ByteBuffer filterChunkToRange(ByteBuffer buf) { if (options.getBlobOptions.getRange() == null) { return buf; } if (resolvedByteRange.getRangeSize() == 0) { buf.position(0); buf.limit(0); } else { long startOffsetInThisChunk = chunkIndex == 0 ? resolvedByteRange.getStartOffset() - offset : 0; long endOffsetInThisChunkExclusive = chunkIndex == (numChunksTotal - 1) ? resolvedByteRange.getEndOffset() - offset + 1 : chunkSize; buf.position((int) startOffsetInThisChunk); buf.limit((int) endOffsetInThisChunkExclusive); } return buf.slice(); }
Source:
<code>public Collection<Container> match(ModuleDescriptor moduleDescriptor, ContainerRepository containerRepository) { LOG.debug("Matching containers for module {}", moduleDescriptor); String criteria = moduleDescriptor.getDeploymentProperties().getCriteria(); List<Container> candidates = new ArrayList<Container>(); for (Iterator<Container> iterator = containerRepository.getContainerIterator(); iterator.hasNext();) { Container container = iterator.next(); LOG.trace("Evaluating container {}", container); if (StringUtils.isEmpty(criteria) || isCandidate(container, criteria)) { LOG.trace("\tAdded container {}", container); candidates.add(container); } } if (candidates.isEmpty()) { <START> return candidates; <END> } int count = moduleDescriptor.getDeploymentProperties().getCount(); int candidateCount = candidates.size(); if (count <= 0 || count >= candidateCount) { return candidates; } else if (count == 1) { if (index + 1 > candidateCount) { index = 0; } return Collections.singleton(candidates.get(index++)); } else { List<Container> targets = new ArrayList<Container>(); while (targets.size() < count) { if (index + 1 > candidateCount) { index = 0; } targets.add(candidates.get(index++)); } return targets; } }</code><technical_language>WARN level message, matching is people want some information</technical_language>

Target:
public Collection<Container> match(ModuleDescriptor moduleDescriptor, ContainerRepository containerRepository) { LOG.debug("Matching containers for module {}", moduleDescriptor); String criteria = moduleDescriptor.getDeploymentProperties().getCriteria(); List<Container> candidates = new ArrayList<Container>(); for (Iterator<Container> iterator = containerRepository.getContainerIterator(); iterator.hasNext();) { Container container = iterator.next(); LOG.trace("Evaluating container {}", container); if (StringUtils.isEmpty(criteria) || isCandidate(container, criteria)) { LOG.trace("\tAdded container {}", container); candidates.add(container); } } if (candidates.isEmpty()) { LOG.warn("No currently available containers match criteria '{}' for module {}.", criteria, moduleDescriptor); return candidates; } int count = moduleDescriptor.getDeploymentProperties().getCount(); int candidateCount = candidates.size(); if (count <= 0 || count >= candidateCount) { return candidates; } else if (count == 1) { if (index + 1 > candidateCount) { index = 0; } return Collections.singleton(candidates.get(index++)); } else { List<Container> targets = new ArrayList<Container>(); while (targets.size() < count) { if (index + 1 > candidateCount) { index = 0; } targets.add(candidates.get(index++)); } return targets; } }
Source:
<code>public Xid[] recover(int flag) throws XAException { <START> log.infof("recover with flags: %s", flag); <END> return new Xid[]{}; }</code><technical_language>tracef</technical_language>

Target:
public Xid[] recover(int flag) throws XAException { log.tracef("recover with flags: %s", flag); return new Xid[]{}; }
Source:
<code>public String pages(Model model, @PathVariable String slug, @RequestParam(required = false) String query, @RequestParam(required = false, defaultValue = "1") int currentPage, @RequestParam(required = false, defaultValue = "false") boolean archived) { Site site = Site.fromSlug(slug); <START> ensureCanDoThis(site, Permission.SEE_PAGES); <END> Collection<Page> pages = (archived) ? getStaticArchivedPages(site) : getStaticPages(site); pages = Strings.isNullOrEmpty(query) ? pages : searchPages(pages, query); SearchUtils.Partition<Page> partition = new SearchUtils.Partition<>(pages, Page.CREATION_DATE_COMPARATOR, PER_PAGE, currentPage); model.addAttribute("site", site); model.addAttribute("query", query); model.addAttribute("partition", partition); model.addAttribute("pages", partition.getItems()); return (archived) ? "fenixedu-cms/archivedPages" : "fenixedu-cms/pages"; }</code><technical_language>SEE_PAGES permission is checked</technical_language>

Target:
public String pages(Model model, @PathVariable String slug, @RequestParam(required = false) String query, @RequestParam(required = false, defaultValue = "1") int currentPage, @RequestParam(required = false, defaultValue = "false") boolean archived) { Site site = Site.fromSlug(slug); ensureCanDoThis(site, Permission.SEE_PAGES); if (archived) { ensureCanDoThis(site, Permission.DELETE_PAGE); } Collection<Page> pages = (archived) ? getStaticArchivedPages(site) : getStaticPages(site); pages = Strings.isNullOrEmpty(query) ? pages : searchPages(pages, query); SearchUtils.Partition<Page> partition = new SearchUtils.Partition<>(pages, Page.CREATION_DATE_COMPARATOR, PER_PAGE, currentPage); model.addAttribute("site", site); model.addAttribute("query", query); model.addAttribute("partition", partition); model.addAttribute("pages", partition.getItems()); return (archived) ? "fenixedu-cms/archivedPages" : "fenixedu-cms/pages"; }
Source:
<code>public static void main(String[] args) { try { handleLaunchArguments(args); fillSubsystemList(); TerasologyEngine engine = new TerasologyEngine(subsystemList); try { engine.init(); if (isHeadless) { engine.run(new StateHeadlessSetup()); } else { engine.run(new StateMainMenu()); } <START> } finally { <END> try { engine.dispose(); } catch (Exception e) { e.printStackTrace(); } } } catch (RuntimeException | IOException e) { if (!isHeadless) { logException(e); } } System.exit(0); }</code><technical_language>surprised this - removed a while ago. editing latest version develop</technical_language>

Target:
public static void main(String[] args) { handlePrintUsageRequest(args); try { handleLaunchArguments(args); TerasologyEngine engine = new TerasologyEngine(createSubsystemList()); try { engine.init(); if (isHeadless) { engine.run(new StateHeadlessSetup()); } else { engine.run(new StateMainMenu()); } } finally { try { engine.dispose(); } catch (Exception e) { e.printStackTrace(); } } } catch (RuntimeException | IOException e) { if (!isHeadless) { logException(e); } } System.exit(0); }
Source:
<code>public void compactInternally() { if (config.compactIntervalMillis() > 0 && checkIfTableHasNotBeenCompactedForCompactIntervalMillis()) { <START> runCompactOnTable(); <END> } }</code><technical_language>a Semaphore guards this method call (make release permit in a finally block)</technical_language>

Target:
public void compactInternally() { if (compactionSemaphore.tryAcquire()) { try { if (shouldRunCompaction()) { runCompactOnTable(); } } finally { compactionSemaphore.release(); } } }
Source:
<code><START> public void handleGetDeviceModelResponse(final GetDeviceModelResponseDto getDeviceModelResponseDto, <END> final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException) { LOGGER.info("handleResponse for MessageType: {}", messageType); ResponseMessageResultType result = ResponseMessageResultType.OK; GetDeviceModelResponse getDeviceModelResponse = null; OsgpException exception = null; try { if (responseMessageResultType == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } this.handleResponseMessageReceived(LOGGER, deviceIdentification); getDeviceModelResponse = this.mapper.map(getDeviceModelResponseDto, GetDeviceModelResponse.class); } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; exception = this.ensureOsgpException(e, "Exception occurred while getting Device Model Response Data"); } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(osgpException) .withDataObject(getDeviceModelResponse).build(), messageType); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Method 7 parameters, is greater 6 authorized. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void handleGetDeviceModelResponse(final GetDeviceModelResponseDto getDeviceModelResponseDto, final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException) { LOGGER.info("handleResponse for MessageType: {}", messageType); ResponseMessageResultType result = ResponseMessageResultType.OK; GetDeviceModelResponse getDeviceModelResponse = null; OsgpException exception = null; try { if (responseMessageResultType == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } this.handleResponseMessageReceived(LOGGER, deviceIdentification); getDeviceModelResponse = this.mapper.map(getDeviceModelResponseDto, GetDeviceModelResponse.class); } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; exception = this.ensureOsgpException(e, "Exception occurred while getting Device Model Response Data"); } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(osgpException) .withDataObject(getDeviceModelResponse).build(); this.webServiceResponseMessageSender.send(responseMessage, messageType); }
Source:
<code>private SpreadsheetReader createReader(InputStream is, List<String> headers) throws IOException { <START> if (myFormat == CSV) { <END> return new CsvReaderImpl(is, createCSVFormat(headers)); } if (myFormat == XLS) { return new XlsReaderImpl(is, headers); } throw new IllegalArgumentException("Unsupported format: " + myFormat); }</code><technical_language>Pls replace switch</technical_language>

Target:
private SpreadsheetReader createReader(InputStream is, List<String> headers) throws IOException { switch (myFormat) { case CSV: return new CsvReaderImpl(is, createCSVFormat(headers)); case XLS: return new XlsReaderImpl(is, headers); default: throw new IllegalArgumentException("Unsupported format: " + myFormat); } }
Source:
<code>public ConfigurationBasedNamespaceManager(Configuration configuration) { this.configuration = configuration; <START> this.configuration.setProperty(Namespaces.W3C_SCHEMA, "xsd"); <END> this.configuration.setProperty(Namespaces.W3C_NAMESPACE, "xmlns"); this.configuration.setProperty(Namespaces.TOSCA_NAMESPACE, "tosca"); this.configuration.setProperty(Namespaces.TOSCA_WINERY_EXTENSIONS_NAMESPACE, "winery"); this.configuration.setProperty(Namespaces.EXAMPLE_NAMESPACE, "ex"); this.configuration.setProperty(Namespaces.URI_OPENTOSCA_NODETYPE, "otnt"); }</code><technical_language>Sort alphabetically</technical_language>

Target:
public ConfigurationBasedNamespaceManager(Configuration configuration) { this.configuration = configuration; this.configuration.setProperty(Namespaces.TOSCA_NAMESPACE, "tosca"); this.configuration.setProperty(Namespaces.TOSCA_WINERY_EXTENSIONS_NAMESPACE, "winery"); this.configuration.setProperty(Namespaces.W3C_XML_SCHEMA_NS_URI, "xsd"); this.configuration.setProperty(Namespaces.W3C_NAMESPACE_URI, "xmlns"); this.configuration.setProperty(Namespaces.EXAMPLE_NAMESPACE_URI, "ex"); this.configuration.setProperty(Namespaces.URI_OPENTOSCA_NODETYPE, "otnt"); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cachePriority == null) ? 0 : cachePriority.hashCode()); result = prime * result + ((columns == null) ? 0 : columns.hashCode()); result = prime * result + ((conflictHandler == null) ? 0 : conflictHandler.hashCode()); result = prime * result + ((partitionStrategy == null) ? 0 : partitionStrategy.hashCode()); result = prime * result + (rangeScanAllowed ? 1231 : 1237); result = prime * result + ((rowMetadata == null) ? 0 : rowMetadata.hashCode()); result = prime * result + (rangeScanAllowed? 0 : 1); result = prime * result + (explicitCompressionBlockSizeKB); result = prime * result + (negativeLookups? 0 : 1); result = prime * result + (sweepStrategy.hashCode()); result = prime * result + (appendHeavyAndReadLight? 0 : 1); <START> result = prime * result + nameLogSafety.hashCode(); END> return result; }</code><technical_language>Line 296 unnecessary brackets surrounding hashCode. consistent - remove brackets 296</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cachePriority == null) ? 0 : cachePriority.hashCode()); result = prime * result + ((columns == null) ? 0 : columns.hashCode()); result = prime * result + ((conflictHandler == null) ? 0 : conflictHandler.hashCode()); result = prime * result + ((partitionStrategy == null) ? 0 : partitionStrategy.hashCode()); result = prime * result + (rangeScanAllowed ? 1231 : 1237); result = prime * result + ((rowMetadata == null) ? 0 : rowMetadata.hashCode()); result = prime * result + (rangeScanAllowed ? 0 : 1); result = prime * result + explicitCompressionBlockSizeKB; result = prime * result + (negativeLookups ? 0 : 1); result = prime * result + sweepStrategy.hashCode(); result = prime * result + (appendHeavyAndReadLight ? 0 : 1); result = prime * result + nameLogSafety.hashCode(); return result; }
Source:
<code><START> public VepAnnotationFileWriter(Long timeoutInSeconds, Integer chunkSize, AnnotationParameters annotationParameters) { <END> if (timeoutInSeconds <= 0) { throw new IllegalArgumentException( "timeout (" + timeoutInSeconds + " seconds) must be strictly greater than 0"); } this.timeoutInSeconds = timeoutInSeconds; this.chunkSize = chunkSize; this.annotationParameters = annotationParameters; alreadyClosed = false; }</code><technical_language>I find difficult understand logic of class mixing call VEP writing of annotation. separate logics? AnnotationParameters instead of independent parameters avoid long list, highlighting this split?</technical_language>

Target:
public VepAnnotationFileWriter(Long timeoutInSeconds, Integer chunkSize, AnnotationParameters annotationParameters) { vepProcess = new VepProcess(annotationParameters, chunkSize, timeoutInSeconds); }
Source:
<code>private Properties saveStoresAndGetConnectorProperties() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, FileNotFoundException { <START> String keystoreFile = "/tmp/server-keystore"; <END> if (serverKeystore!=null) serverKeystore.store( new FileOutputStream(keystoreFile), new char[0]); String truststoreFile = "/tmp/server-truststore"; if (serverTruststore!=null) serverTruststore.store( new FileOutputStream(truststoreFile), new char[0]); Properties p = new Properties(); p.put(JmxmpAgent.JMXMP_KEYSTORE_FILE_PROPERTY, keystoreFile); p.put(JmxmpAgent.JMXMP_TRUSTSTORE_FILE_PROPERTY, truststoreFile); p.put(JmxmpAgent.USE_SSL_PROPERTY, "true"); p.put(JmxmpAgent.AUTHENTICATE_CLIENTS_PROPERTY, "true"); return p; }</code><technical_language>Do files new need names of a structure? File.createTempFile</technical_language>

Target:
private Properties saveStoresAndGetConnectorProperties() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, FileNotFoundException { String keystoreFile = File.createTempFile("server-keystore", ".jmx.test").getAbsolutePath(); String truststoreFile = File.createTempFile("server-truststore", ".jmx.test").getAbsolutePath(); if (serverKeystore!=null) serverKeystore.store( new FileOutputStream(keystoreFile), new char[0]); if (serverTruststore!=null) serverTruststore.store( new FileOutputStream(truststoreFile), new char[0]); Properties p = new Properties(); p.put(JmxmpAgent.JMXMP_KEYSTORE_FILE_PROPERTY, keystoreFile); p.put(JmxmpAgent.JMXMP_TRUSTSTORE_FILE_PROPERTY, truststoreFile); p.put(JmxmpAgent.USE_SSL_PROPERTY, "true"); p.put(JmxmpAgent.AUTHENTICATE_CLIENTS_PROPERTY, "true"); return p; }
Source:
<code>private void resetCluster(FileSystemMaster fsm) throws Exception { if (!mCluster.get().getLocalAlluxioMaster().isServing()) { mCluster.mLocalAlluxioCluster.startMasters(); <START> fsm = mCluster.mLocalAlluxioCluster.getLocalAlluxioMaster().getMasterProcess() <END> .getMaster(FileSystemMaster.class); } if (!mCluster.get().isStartedWorkers()) { BlockMaster bm = mCluster.get().getLocalAlluxioMaster().getMasterProcess().getMaster(BlockMaster.class); CommonUtils.waitFor("", () -> { try { return bm.getWorkerInfoList().isEmpty(); } catch (Exception e) { return false; } }, WaitForOptions.defaults().setInterval(10).setTimeoutMs(1000)); mCluster.get().startWorkers(); } fsm.updateUfsMode(new AlluxioURI(fsm.getUfsAddress()), UfsMode.READ_WRITE); for (FileInfo fileInfo : fsm .listStatus(new AlluxioURI("/"), ListStatusContext.defaults())) { fsm.delete(new AlluxioURI(fileInfo.getPath()), DeleteContext .create(DeletePOptions.newBuilder().setUnchecked(true).setRecursive(true))); } }</code><technical_language>weird set parameter user passes in</technical_language>

Target:
private void resetCluster(FileSystemMaster fsm) throws Exception { if (!mCluster.get().getLocalAlluxioMaster().isServing()) { mCluster.mLocalAlluxioCluster.startMasters(); fsm = mCluster.mLocalAlluxioCluster.getLocalAlluxioMaster().getMasterProcess() .getMaster(FileSystemMaster.class); } if (!mCluster.get().isStartedWorkers()) { BlockMaster bm = mCluster.get().getLocalAlluxioMaster().getMasterProcess().getMaster(BlockMaster.class); CommonUtils.waitFor("all workers to be considered lost by the master", () -> { try { return bm.getWorkerInfoList().isEmpty(); } catch (Exception e) { return false; } }, WaitForOptions.defaults().setInterval(10).setTimeoutMs(1000)); mCluster.get().startWorkers(); } fsm.updateUfsMode(new AlluxioURI(fsm.getUfsAddress()), UfsMode.READ_WRITE); for (FileInfo fileInfo : fsm .listStatus(new AlluxioURI("/"), ListStatusContext.defaults())) { fsm.delete(new AlluxioURI(fileInfo.getPath()), DeleteContext .create(DeletePOptions.newBuilder().setUnchecked(true).setRecursive(true))); } }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); Config config = environment.getConfig(); if (!config.getCourseDiscoveryConfig().isWebCourseSearchEnabled()) { return result; } getMenuInflater().inflate(R.menu.find_courses, menu); final MenuItem searchItem = menu.findItem(R.id.menu_item_search); searchView = (SearchView) searchItem.getActionView(); Resources resources = getResources(); searchView.setQueryHint(resources.getString(R.string.search_for_courses)); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { String baseUrl = environment.getConfig().getCourseDiscoveryConfig().getCourseSearchUrl(); String searchUrl = buildQuery(baseUrl, query, logger); searchView.clearFocus(); webView.loadUrl(searchUrl); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean queryTextFocused) { if (!queryTextFocused) { <START> searchActive = false; <END> searchItem.collapseActionView(); dismissKeyboard(); showDrawerButton(true); } else { searchActive = true; showDrawerButton(false); } } }); return result; }</code><technical_language>check for searchView.hasFocus(), instead of set this flag</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); Config config = environment.getConfig(); if (!config.getCourseDiscoveryConfig().isWebCourseSearchEnabled()) { return result; } getMenuInflater().inflate(R.menu.find_courses, menu); final MenuItem searchItem = menu.findItem(R.id.menu_item_search); searchView = (SearchView) searchItem.getActionView(); Resources resources = getResources(); searchView.setQueryHint(resources.getString(R.string.search_for_courses)); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { String baseUrl = environment.getConfig().getCourseDiscoveryConfig().getCourseSearchUrl(); String searchUrl = buildQuery(baseUrl, query, logger); searchView.onActionViewCollapsed(); webView.loadUrl(searchUrl); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean queryTextFocused) { if (!queryTextFocused) { searchView.onActionViewCollapsed(); } enableDrawerMenuButton(!queryTextFocused); } }); return result; }
Source:
<code>private void startListeningInternal() { <START> startListening(); <END> isListening = true; value = calculate(); }</code><technical_language>startListening is overridable calls other code this class control over. in this method prevent possibility of other code calling this object while in invalid intermediate state</technical_language>

Target:
private void startListeningInternal() { isListening = true; value = calculate(); startListening(); }
Source:
<code>public void evaluateRequest(HttpServerRequest request) throws HttpAuthenticationException { List<String> authorizationValues = request.getRequestHeaderValues("Authorization"); if (authorizationValues == null || authorizationValues.isEmpty()) { request.authenticationFailed("Bearer token required", response -> response.setStatusCode(401)); return; } else if (authorizationValues.size() > 1) { request.authenticationFailed("Multiple Authorization headers found", response -> response.setStatusCode(400)); return; } String authorizationValue = authorizationValues.get(0); Matcher matcher = BEARER_TOKEN_PATTERN.matcher(authorizationValue); if (!matcher.matches()) { request.authenticationFailed("Authorization is not Bearer", response -> response.setStatusCode(400)); return; } BearerTokenEvidence tokenEvidence = new BearerTokenEvidence(matcher.group(1)); try { EvidenceVerifyCallback verifyCallback = new EvidenceVerifyCallback(tokenEvidence); callbackHandler.handle(new Callback[] {verifyCallback}); if (verifyCallback.isVerified()) { AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, null); callbackHandler.handle(new Callback[] {authorizeCallback}); if (authorizeCallback.isAuthorized()) { <START> callbackHandler.handle(new Callback[]{new IdentityCredentialCallback(new BearerTokenCredential(tokenEvidence.getToken()), true), AuthenticationCompleteCallback.SUCCEEDED}); <END> request.authenticationComplete(); return; } } invalidBearerToken(request); } catch (IOException | UnsupportedCallbackException e) { throw new HttpAuthenticationException(e); } }</code><technical_language>handled separately in case of is unsupported</technical_language>

Target:
public void evaluateRequest(HttpServerRequest request) throws HttpAuthenticationException { List<String> authorizationValues = request.getRequestHeaderValues("Authorization"); if (authorizationValues == null || authorizationValues.isEmpty()) { request.authenticationFailed("Bearer token required", response -> response.setStatusCode(401)); return; } else if (authorizationValues.size() > 1) { request.authenticationFailed("Multiple Authorization headers found", response -> response.setStatusCode(400)); return; } String authorizationValue = authorizationValues.get(0); Matcher matcher = BEARER_TOKEN_PATTERN.matcher(authorizationValue); if (!matcher.matches()) { request.authenticationFailed("Authorization is not Bearer", response -> response.setStatusCode(400)); return; } BearerTokenEvidence tokenEvidence = new BearerTokenEvidence(matcher.group(1)); EvidenceVerifyCallback verifyCallback = new EvidenceVerifyCallback(tokenEvidence); handleCallback(verifyCallback); if (verifyCallback.isVerified()) { AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, null); handleCallback(authorizeCallback); if (authorizeCallback.isAuthorized()) { handleCallback(new IdentityCredentialCallback(new BearerTokenCredential(tokenEvidence.getToken()), true)); handleCallback(AuthenticationCompleteCallback.SUCCEEDED); request.authenticationComplete(); return; } } request.authenticationFailed("Invalid bearer token", response -> response.setStatusCode(403)); }
Source:
<code>public void sendFull(RequestType requestType) { switch (requestType) { case QUERY: StringBuilder query = new StringBuilder(); generate(query, schema.getQueryType(), 0); requestor.sendQuery(query.toString()); break; case MUTATION: StringBuilder mutation = new StringBuilder("mutation "); generate(mutation, schema.getMutationType(), 0); requestor.sendQuery(mutation.toString()); break; case SUBSCRIPTION: <START> StringBuilder subscription = new StringBuilder("subscription "); <END> generate(subscription, schema.getSubscriptionType(), 0); requestor.sendQuery(subscription.toString()); break; } }</code><technical_language>This is of strings, specifically a trailing space. extract constants for them</technical_language>

Target:
public void sendFull(RequestType requestType) { switch (requestType) { case MUTATION: StringBuilder mutation = new StringBuilder(OPERATION_TYPE_MUTATION); generate(mutation, schema.getMutationType(), 0); requestor.sendQuery(mutation.toString(), param.getRequestMethod()); break; case SUBSCRIPTION: StringBuilder subscription = new StringBuilder(OPERATION_TYPE_SUBSCRIPTION); generate(subscription, schema.getSubscriptionType(), 0); requestor.sendQuery(subscription.toString(), param.getRequestMethod()); break; case QUERY: default: StringBuilder query = new StringBuilder(); generate(query, schema.getQueryType(), 0); requestor.sendQuery(query.toString(), param.getRequestMethod()); break; } }
Source:
<code><START> public void onClick(DialogInterface dialog, int which) { <END> if (which == DialogInterface.BUTTON_POSITIVE && saveEngines()) { setResult(RESULT_OK); Toast.makeText(this, R.string.sync_notification_savedprefs, Toast.LENGTH_SHORT).show(); } else { setResult(RESULT_CANCELED); } finish(); }</code><technical_language>I canceling causing a pop-up message is unnecessary a wordy, if feel strongly that, chat it</technical_language>

Target:
public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) { Logger.debug(LOG_TAG, "Saving selected engines."); saveSelections(); setResult(RESULT_OK); Toast.makeText(this, R.string.sync_notification_savedprefs, Toast.LENGTH_SHORT).show(); } else { setResult(RESULT_CANCELED); } finish(); }
Source:
<code><START> public void testGlobJs3() throws IOException { <END> try { FlagEntry<JsSourceType> jsFile1 = createJsFile("test1", "var a;"); FlagEntry<JsSourceType> jsFile2 = createJsFile("test2", "var b;"); new File(jsFile2.value).renameTo(new File( new File(jsFile1.value).getParentFile() + File.separator + "test2.js")); String glob1 = new File(jsFile1.value).getParent() + File.separator + "**.js"; String glob2 = "!" + new File(jsFile1.value).getParent() + File.separator + "**test2.js"; compileFiles( "var a;", new FlagEntry<>(JsSourceType.JS, glob1), new FlagEntry<>(JsSourceType.JS, glob2)); } catch (FlagUsageException e) { fail("Unexpected exception" + e); } }</code><technical_language>include FlagUsageException in throws if thrown count a failure</technical_language>

Target:
public void testGlobJs3() throws IOException, FlagUsageException { FlagEntry<JsSourceType> jsFile1 = createJsFile("test1", "var a;"); FlagEntry<JsSourceType> jsFile2 = createJsFile("test2", "var b;"); new File(jsFile2.value).renameTo(new File( new File(jsFile1.value).getParentFile() + File.separator + "test2.js")); String glob1 = new File(jsFile1.value).getParent() + File.separator + "**.js"; String glob2 = "!" + new File(jsFile1.value).getParent() + File.separator + "**test2.js"; compileFiles( "var a;", new FlagEntry<>(JsSourceType.JS, glob1), new FlagEntry<>(JsSourceType.JS, glob2)); }
Source:
<code><T, C extends PreCommitCondition, E extends Exception> T runTaskWithConditionThrowOnConflict( C condition, ConditionAwareTransactionTask<T, C, E> task) throws E, TransactionFailedRetriableException; @Timed <T, C extends PreCommitCondition, E extends Exception> T runTaskWithConditionReadOnly( C condition, ConditionAwareTransactionTask<T, C, E> task) throws E; long getImmutableTimestamp(); LockService getLockService(); TimelockService getTimelockService(); default KvsLockWatchingService getLockWatchingService() { <START> return null; <END> }</code><technical_language>I safer return a throwing service null? In case accidentally depend this codepath</technical_language>

Target:
<T, C extends PreCommitCondition, E extends Exception> T runTaskWithConditionThrowOnConflict( C condition, ConditionAwareTransactionTask<T, C, E> task) throws E, TransactionFailedRetriableException; @Timed <T, C extends PreCommitCondition, E extends Exception> T runTaskWithConditionReadOnly( C condition, ConditionAwareTransactionTask<T, C, E> task) throws E; long getImmutableTimestamp(); LockService getLockService(); TimelockService getTimelockService(); default KvsLockWatchingService getLockWatchingService() { return NoOpKvsLockWatchingService.INSTANCE; }
Source:
<code><START> public Builder tag(final Map<String, String> tagsToAdd) { <END> for (Entry<String, String> tag : tagsToAdd.entrySet()) { if (CheckTags.isTagNameLegal(tag.getKey()) && CheckTags.isTagValueLegal(tag.getValue())) { tag(tag.getKey(), tag.getValue()); } } return this; }</code><technical_language>do checks in tag methods</technical_language>

Target:
public Builder tag(final Map<String, String> tagsToAdd) { for (Entry<String, String> tag : tagsToAdd.entrySet()) { if (CheckTags.isLegalFullCheck(tag.getKey(), tag.getValue())) { tags.put(tag.getKey(), tag.getValue()); } } return this; }
Source:
<code>private void updateIndex(Page page) { index.addPage(page); int numPositions = index.getPositionCount(); long estimatedPagesHashSize = calculatedPredictedSizeDelta(numPositions); if (spillEnabled) { <START> localRevocableMemoryContext.setBytes(index.getEstimatedSize().toBytes() + estimatedPagesHashSize); <END> } else { if (!localUserMemoryContext.trySetBytes(index.getEstimatedSize().toBytes() + estimatedPagesHashSize)) { index.compact(); localUserMemoryContext.setBytes(index.getEstimatedSize().toBytes() + estimatedPagesHashSize); } } operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); }</code><technical_language>Instead of repeating addition assign a stack</technical_language>

Target:
private void updateIndex(Page page) { index.addPage(page); int numPositions = index.getPositionCount(); long estimatedSizeAfterBuild = index.getEstimatedSize().toBytes() + PagesHash.getEstimatedAdditionalSize(numPositions); if (spillEnabled) { localRevocableMemoryContext.setBytes(estimatedSizeAfterBuild); } else { if (!localUserMemoryContext.trySetBytes(estimatedSizeAfterBuild)) { index.compact(); localUserMemoryContext.setBytes(index.getEstimatedSize().toBytes() + PagesHash.getEstimatedAdditionalSize(numPositions)); } } operatorContext.recordOutput(page.getSizeInBytes(), page.getPositionCount()); }
Source:
<code>private List<Pair<Guid, Pair<Integer, Integer>>> getUnutilizedResources(List<VDS> hosts) { List<Pair<Guid, Pair<Integer, Integer>>> hostsUnutilizedResources = new ArrayList<>(); for (VDS host : hosts) { Pair<Integer, Integer> innerUnutilizedCpuRamPair = new Pair<>(); int hostFreeCpu = 0; if (host.getUsageCpuPercent() != null) { hostFreeCpu = 100 - host.getUsageCpuPercent(); } innerUnutilizedCpuRamPair.setFirst(hostFreeCpu); int hostFreeMem = 0; if (host.getPhysicalMemMb() != null && host.getUsageMemPercent() != null) { int usedMem = (int) Math.round(host.getPhysicalMemMb() * (host.getUsageMemPercent() / 100.0)); hostFreeMem = host.getPhysicalMemMb() - usedMem; } innerUnutilizedCpuRamPair.setSecond(hostFreeMem); Pair<Guid, Pair<Integer, Integer>> outerUnutilizedCpuRamPair = new Pair<>(host.getId(), innerUnutilizedCpuRamPair); outerUnutilizedCpuRamPair.setFirst(host.getId()); <START> outerUnutilizedCpuRamPair.setSecond(innerUnutilizedCpuRamPair); <END> hostsUnutilizedResources.add(outerUnutilizedCpuRamPair); } return hostsUnutilizedResources; }</code><technical_language>2 lines redundant in constructor..</technical_language>

Target:
private List<Pair<Guid, Pair<Integer, Integer>>> getUnutilizedResources(List<VDS> hosts) { List<Pair<Guid, Pair<Integer, Integer>>> hostsUnutilizedResources = new ArrayList<>(); for (VDS host : hosts) { Pair<Integer, Integer> innerUnutilizedCpuRamPair = new Pair<>(); int hostFreeCpu = 0; if (host.getUsageCpuPercent() != null) { hostFreeCpu = 100 - host.getUsageCpuPercent(); } innerUnutilizedCpuRamPair.setFirst(hostFreeCpu); int hostFreeMem = (int) host.getMaxSchedulingMemory(); innerUnutilizedCpuRamPair.setSecond(hostFreeMem); Pair<Guid, Pair<Integer, Integer>> outerUnutilizedCpuRamPair = new Pair<>(host.getId(), innerUnutilizedCpuRamPair); hostsUnutilizedResources.add(outerUnutilizedCpuRamPair); } return hostsUnutilizedResources; }