auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public final void testGetBoxScanWithReadErrorsReturnsError() throws Exception { final long id = 1L; final JSONObject error = new JSONObject(); final JSONObject errorComponents = new JSONObject(); errorComponents.put("errorPositions", "[]"); errorComponents.put("successPositions", "[]"); errorComponents.put("message", "The scanner can not read some positions. Please remove or fix and then rescan: "); errorComponents.put("type", "Read Error"); error.put("errors", errorComponents); Box box = makeEmptyBox(); when(scan.getRowCount()).thenReturn(box.getSize().getRows()); when(scan.getColumnCount()).thenReturn(box.getSize().getColumns()); when(boxScanner.getScan()).thenReturn(scan); when(scan.getReadErrorPositions()).thenReturn(Arrays.asList("A01")); <START> when(requestManager.getBoxById(1L)).thenReturn(box); <END> JSONObject json = new JSONObject(); json.put("boxId", id); assertTrue(boxControllerHelperService.getBoxScan(null, json).getJSONArray("errors").size() > 0); }</code><technical_language>error errorComponents unused, removed</technical_language>

Target:
public final void testGetBoxScanWithReadErrorsReturnsError() throws Exception { final long id = 1L; Box box = makeEmptyBox(); when(scan.getRowCount()).thenReturn(box.getSize().getRows()); when(scan.getColumnCount()).thenReturn(box.getSize().getColumns()); when(boxScanner.getScan()).thenReturn(scan); when(scan.getReadErrorPositions()).thenReturn(Arrays.asList("A01")); when(requestManager.getBoxById(1L)).thenReturn(box); JSONObject json = new JSONObject(); json.put("boxId", id); assertTrue(boxControllerHelperService.getBoxScan(null, json).getJSONArray("errors").size() > 0); }
Source:
<code>public Example<Instance> nextInstance() { InstancesHeader header = getHeader(); <START> Instance inst = new DenseInstance(header.numAttributes()); <END> String kafkaString = getNextInstanceFromKafka(); String[] KeyValueString = kafkaString.split(":"); String[] attributes = KeyValueString[1].split(","); for (int i = 0; i < attributes.length - 1; i++) { if (i < numAttrOption.getValue()) { inst.setValue(i, Double.parseDouble(attributes[i])); } } inst.setDataset(header); inst.setClassValue(Double .parseDouble(attributes[attributes.length - 1])); try { Thread.sleep(timeDelayOption.getValue()); } catch (InterruptedException e) { e.printStackTrace(); } return new InstanceExample(inst); }</code><technical_language>data a Dense/Sparse Instance</technical_language>

Target:
public Example<Instance> nextInstance() { InstancesHeader header = getHeader(); Instance inst; String kafkaString = getNextInstanceFromKafka(); inst = mapper.getInstance(kafkaString, keyValueSeparator.getValue(), valuesSeparator.getValue(), instanceType.getValue(), numAttrOption.getValue(), header); try { Thread.sleep(timeDelayOption.getValue()); } catch (InterruptedException e) { e.printStackTrace(); } return new InstanceExample(inst); }
Source:
<code>public void test() throws SQLException { Statement s = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = null; try { <START> s.executeUpdate("INSERT INTO table1(" + columnName + ") VALUES(" + originalValue + ")"); <END> rs = s.executeQuery(TestUtil.selectSQL("table1", "table1_id, " + columnName)); rs.next(); rs.updateObject(2, newValue); rs.updateRow(); rs.close(); rs = s.executeQuery(TestUtil.selectSQL("table1", columnName)); rs.next(); assertEquals(newValue, rs.getObject(1, newValue.getClass())); } finally { if (rs != null) { rs.close(); } s.close(); } }</code><technical_language>Do need insert data a physical table? select cast(? datatype) result enough</technical_language>

Target:
public void test() throws SQLException { Statement s = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = null; try { s.executeUpdate("INSERT INTO table1(" + columnName + ") VALUES(" + originalValue + ")"); rs = s.executeQuery(TestUtil.selectSQL("table1", "table1_id, " + columnName)); rs.next(); rs.updateObject(2, newValue); rs.updateRow(); rs.close(); rs = s.executeQuery(TestUtil.selectSQL("table1", columnName)); rs.next(); assertEquals("Object wasn't identical when it got read back from the database", newValue, rs.getObject(1, newValueClass)); } finally { TestUtil.closeQuietly(rs); TestUtil.closeQuietly(s); } }
Source:
<code>private BallColor getCombinedBallColor() { Boolean taskIsBuilding = false; Boolean oneTaskIsIncomplete = false; Result combinedResult = null; for(Job job : this.folder.getAllJobs()) { Run build = job.getLastBuild(); if(build == null) { oneTaskIsIncomplete = true; continue; } if(build.isBuilding()) { taskIsBuilding = true; build = job.getLastCompletedBuild(); <START> if(build == null) continue; <END> } Result result = build.getResult(); if(combinedResult == null) { combinedResult = result; } else { combinedResult = combinedResult.combine(result); } } BallColor cumulativeIcon = null; if(oneTaskIsIncomplete) { cumulativeIcon = BallColor.NOTBUILT; } else if(combinedResult != null) { cumulativeIcon = combinedResult.color; } if(taskIsBuilding) { cumulativeIcon = cumulativeIcon.anime(); } return cumulativeIcon; }</code><technical_language>Based icon calculated, adding speed calculation: if (oneTaskIsIncomplete) { break; }</technical_language>

Target:
private BallColor getCombinedBallColor() { Boolean taskIsBuilding = false; Boolean oneTaskIsIncomplete = false; Result combinedResult = null; for(Job job : this.folder.getAllJobs()) { Run build = job.getLastBuild(); if(build == null) { oneTaskIsIncomplete = true; continue; } if(build.isBuilding()) { taskIsBuilding = true; build = job.getLastCompletedBuild(); if(build == null) continue; } if (oneTaskIsIncomplete) { break; } Result result = build.getResult(); if(combinedResult == null) { combinedResult = result; } else { combinedResult = combinedResult.combine(result); } } BallColor cumulativeIcon = null; if(oneTaskIsIncomplete) { cumulativeIcon = BallColor.NOTBUILT; } else { assert combinedResult != null; cumulativeIcon = combinedResult.color; } if(taskIsBuilding) { cumulativeIcon = cumulativeIcon.anime(); } return cumulativeIcon; }
Source:
<code>public void close() { <START> if (creditConsumer != null) { <END> creditConsumer.unregister(); } if (endHandler != null) { vertx.runOnContext(v -> endHandler.handle(null)); } }</code><technical_language>code of close moved end(Handler<AsyncResult<Void>) instead, public synchronized void end(Handler<AsyncResult<Void>> completionHandler) { if (creditConsumer != null) { creditConsumer.unregister(); } if (endHandler != null) { endHandler.handler(Future.succeededFuture()); } }</technical_language>

Target:
public synchronized void close() { checkClosed(); closed = true; if (pending.isEmpty()) { handleClosed(); } }
Source:
<code>private HystrixConcurrencyStrategy getConcurrencyStrategy() { HystrixConcurrencyStrategy registeredStrategy = HystrixPlugins.getInstance() .getConcurrencyStrategy(); if (registeredStrategy != null <START> && !registeredStrategy.equals(HystrixConcurrencyStrategyDefault.getInstance()) <END> && !registeredStrategy.equals(existingConcurrencyStrategy)) { throw new IllegalStateException("Multiple HystrixConcurrencyStrategy detected."); } return existingConcurrencyStrategy != null ? existingConcurrencyStrategy : registeredStrategy; }</code><technical_language>check if instanceof</technical_language>

Target:
private HystrixConcurrencyStrategy getConcurrencyStrategy() { HystrixConcurrencyStrategy registeredStrategy = HystrixPlugins.getInstance() .getConcurrencyStrategy(); if (existingConcurrencyStrategy == null) { return registeredStrategy; } if (registeredStrategy instanceof HystrixConcurrencyStrategyDefault){ return existingConcurrencyStrategy; } if (!existingConcurrencyStrategy.equals(registeredStrategy)){ throw new IllegalStateException("Multiple HystrixConcurrencyStrategy detected."); } return existingConcurrencyStrategy; }
Source:
<code>public CompletableFuture<String> generateMap(String mapName) { Matcher matcher = GENERATED_MAP_PATTERN.matcher(mapName); if (!matcher.find()) { <START> return CompletableFuture.supplyAsync(() -> { <END> throw new IllegalArgumentException("Map name is not a generated map"); }); } return generateMap(matcher.group(1), matcher.group(2)); }</code><technical_language>I is a static Method CompletableFuture class</technical_language>

Target:
public CompletableFuture<String> generateMap(String mapName) { Matcher matcher = GENERATED_MAP_PATTERN.matcher(mapName); if (!matcher.find()) { return CompletableFuture.failedFuture(new InvalidParameterException("Map name is not a generated map")); } return generateMap(matcher.group(1), matcher.group(2)); }
Source:
<code>@Override public Iterator<? extends TripPatternInfo<TripSchedule>> patternIterator( IntIterator stops ) { Set<TripPatternInfo<TripSchedule>> activeTripPatternsForGivenStops = new HashSet<>(); int stopIndex = stops.next(); while (stopIndex > 0) { activeTripPatternsForGivenStops.addAll(activeTripPatternsPerStop.get(stopIndex)); stopIndex = stops.next(); } <START> return activeTripPatternsForGivenStops.iterator(); <END> }</code><technical_language>loop fails if stops contains _the first_ stop (0). method be: Set<TripPatternInfo<TripSchedule>> activeTripPatternsForGivenStops = new HashSet<>(); while (stops.hasNext()) { activeTripPatternsForGivenStops.addAll(activeTripPatternsPerStop.get(stops.next())); } return activeTripPatternsForGivenStops.iterator();</technical_language>

Target:
@Override public Iterator<? extends TripPatternInfo<TripSchedule>> patternIterator( IntIterator stops ) { Set<TripPatternInfo<TripSchedule>> activeTripPatternsForGivenStops = new HashSet<>(); while (stops.hasNext()) { activeTripPatternsForGivenStops.addAll(activeTripPatternsPerStop.get(stops.next())); } return activeTripPatternsForGivenStops.iterator(); }
Source:
<code><START> public Single<String> getP18ForItem(String entityId) { return depictsInterface.getImageForEntity(entityId) .map(commonsFilename -> { String name; try { JsonObject claims = commonsFilename.getAsJsonObject("claims").getAsJsonObject(); JsonObject p18 = claims.get("P18").getAsJsonArray().get(0).getAsJsonObject(); JsonObject mainsnak = p18.get("mainsnak").getAsJsonObject(); JsonObject datavalue = mainsnak.get("datavalue").getAsJsonObject(); JsonPrimitive value = datavalue.get("value").getAsJsonPrimitive(); name = value.toString(); name = name.substring(1, name.length() - 1); } catch (Exception e) { <END> name=""; } if (!name.isEmpty()){ return getThumbnailUrl(name); } else return NO_DEPICTED_IMAGE; }) .singleOrError(); }</code><technical_language>Please define concrete classes instead of JsonObject. I guess I added some of classes in PR #3449. I base PR structured-data branch reuse it</technical_language>

Target:
public Single<String> getP18ForItem(String entityId) { return depictsInterface.getImageForEntity(entityId) .map(claimsResponse -> { final List<Statement_partial> imageClaim = claimsResponse.getClaims() .get(WikidataProperties.IMAGE.getPropertyName()); if (imageClaim != null) { final DataValueString dataValue = (DataValueString) imageClaim .get(0) .getMainSnak() .getDataValue(); return getThumbnailUrl((dataValue.getValue())); } return NO_DEPICTED_IMAGE; }) .singleOrError(); }
Source:
<code>public void onPause() { super.onPause(); mapView.onPause(); if (offlineManager != null) { offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() { @Override public void onList(OfflineRegion[] offlineRegions) { if (offlineRegions.length > 0) { offlineRegions[(offlineRegions.length - 1)].delete(new OfflineRegion.OfflineRegionDeleteCallback() { @Override public void onDelete() { <START> Toast.makeText(SimpleOfflineMapActivity.this, "Yosemite offline map deleted", Toast.LENGTH_LONG).show(); <END> } @Override public void onError(String error) { Log.e(TAG, "On Delete error: " + error); } }); } } @Override public void onError(String error) { Log.e(TAG, "onListError: " + error); } }); } }</code><technical_language>Remove hard-coded string, in part of [future multi-language support](<LINK_0></technical_language>

Target:
public void onPause() { super.onPause(); mapView.onPause(); if (offlineManager != null) { offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() { @Override public void onList(OfflineRegion[] offlineRegions) { if (offlineRegions.length > 0) { offlineRegions[(offlineRegions.length - 1)].delete(new OfflineRegion.OfflineRegionDeleteCallback() { @Override public void onDelete() { Toast.makeText( SimpleOfflineMapActivity.this, getString(R.string.basic_offline_deleted_toast), Toast.LENGTH_LONG ).show(); } @Override public void onError(String error) { Log.e(TAG, "On Delete error: " + error); } }); } } @Override public void onError(String error) { Log.e(TAG, "onListError: " + error); } }); } }
Source:
<code><START> public String getSampleRequestPayload() { <END> return "{\n" + " \"eventType\": rmwebhook-create\n" + " \"resource\": {" + " \"webhookName\": \"webhook name\"\n" + " \"payloadUrl\": \"<LINK_0>\"\n" + " \"secret\": \"secret\"\n" + " }" + "}"; }</code><technical_language>is this used</technical_language>

Target:
public String getSampleRequestPayload() { return "{\n" + " \"eventType\": rmwebhook-create\n" + " \"resource\": {" + " \"webhookName\": \"webhook name\"\n" + " \"payloadUrl\": \"<LINK_1>\"\n" + " \"secret\": \"secret\"\n" + " }" + "}"; }
Source:
<code>public void setup() { <START> Values.setNanoPrecision( 6 ); <END> }</code><technical_language>Is in testing more setting here? I agree this is highest priority is default, extremes of 0 9 worth checking</technical_language>

Target:
public void setup() { prevPrecision = Values.getNanoPrecision(); Values.setNanoPrecision( 6 ); }
Source:
<code>private Tuple<MoveValidationResult, List<Unit>> validateMoveWithDependents( final List<Unit> units, final Map<Unit, Unit> unitsToTransports, final Route route) { final List<Unit> bestWithDependents = addMustMoveWith(units); final MoveValidationResult result; <START> getData().acquireReadLock(); <END> try { final MoveDescription move = new MoveDescription(bestWithDependents, route, unitsToTransports, dependentUnits); result = AbstractMoveDelegate.validateMove( moveType, move, getCurrentPlayer(), nonCombat, getUndoableMoves(), getData()); } finally { getData().releaseReadLock(); } return Tuple.of(result, bestWithDependents); }</code><technical_language>Is previous code a read lock is obvious? If not, a read lock</technical_language>

Target:
private MoveValidationResultWithDependents validateMoveWithDependents( final List<Unit> units, final Map<Unit, Unit> unitsToTransports, final Route route) { final List<Unit> unitsWithDependents = addMustMoveWith(units); final MoveValidationResult result; getData().acquireReadLock(); try { final MoveDescription move = new MoveDescription(unitsWithDependents, route, unitsToTransports, dependentUnits); result = AbstractMoveDelegate.validateMove( moveType, move, getCurrentPlayer(), nonCombat, getUndoableMoves(), getData()); } finally { getData().releaseReadLock(); } return new MoveValidationResultWithDependents(result, unitsWithDependents); }
Source:
<code>private TradeInfo parseTradeInfo(CsvRow row) { TradeInfoBuilder infoBuilder = TradeInfo.builder(); String scheme = row.findField(ID_SCHEME_FIELD).orElse(DEFAULT_TRADE_SCHEME); row.findValue(ID_FIELD).ifPresent(id -> infoBuilder.id(StandardId.of(scheme, id))); <START> String schemeCpty = row.findField(CTPY_SCHEME_FIELD).orElse(DEFAULT_CTPY_SCHEME); <END> Optional<String> cptyOption = row.findValue(CTPY_FIELD); if (cptyOption.isPresent() && !cptyOption.get().equals(EMPTY)) { infoBuilder.counterparty(StandardId.of(schemeCpty, cptyOption.get())); } row.findValue(TRADE_DATE_FIELD).ifPresent(dateStr -> infoBuilder.tradeDate(LoaderUtils.parseDate(dateStr))); row.findValue(TRADE_TIME_FIELD).ifPresent(timeStr -> infoBuilder.tradeTime(LoaderUtils.parseTime(timeStr))); row.findValue(TRADE_ZONE_FIELD).ifPresent(zoneStr -> infoBuilder.zone(ZoneId.of(zoneStr))); resolver.parseTradeInfo(row, infoBuilder); return infoBuilder.build(); }</code><technical_language>findValue() findField(). This default empty schemes</technical_language>

Target:
private TradeInfo parseTradeInfo(CsvRow row) { TradeInfoBuilder infoBuilder = TradeInfo.builder(); String scheme = row.findField(ID_SCHEME_FIELD).orElse(DEFAULT_TRADE_SCHEME); row.findValue(ID_FIELD).ifPresent(id -> infoBuilder.id(StandardId.of(scheme, id))); String schemeCpty = row.findValue(CPTY_SCHEME_FIELD).orElse(DEFAULT_CPTY_SCHEME); row.findValue(CPTY_FIELD).ifPresent(cpty -> infoBuilder.counterparty(StandardId.of(schemeCpty, cpty))); row.findValue(TRADE_DATE_FIELD).ifPresent(dateStr -> infoBuilder.tradeDate(LoaderUtils.parseDate(dateStr))); row.findValue(TRADE_TIME_FIELD).ifPresent(timeStr -> infoBuilder.tradeTime(LoaderUtils.parseTime(timeStr))); row.findValue(TRADE_ZONE_FIELD).ifPresent(zoneStr -> infoBuilder.zone(ZoneId.of(zoneStr))); resolver.parseTradeInfo(row, infoBuilder); return infoBuilder.build(); }
Source:
<code>public void testJerseyClientBuilder(@ArquillianResource URL webAppURL) throws Exception { reloadServer(); final URI uri = new URI(webAppURL.toExternalForm() + JerseyClientTestServlet.SERVLET_PATH.substring(1)); <START> Utils.makeCall(uri, true ? HttpServletResponse.SC_OK : HttpServletResponse.SC_INTERNAL_SERVER_ERROR); <END> }</code><technical_language>@dcihak this check for SC_OK</technical_language>

Target:
public void testJerseyClientBuilder(@ArquillianResource URL webAppURL) throws Exception { final URI uri = new URI(webAppURL.toExternalForm() + JerseyClientTestServlet.SERVLET_PATH.substring(1)); Utils.makeCall(uri, HttpServletResponse.SC_OK); }
Source:
<code>private void updatedMap() { document.setMetaDataDirty(true); <START> this.setCollection(map.values()); <END> }</code><technical_language>This is right. need pass a new new ArrayList setCollection() values() is a List call decorated() crash</technical_language>

Target:
private void updatedMap() { document.setMetaDataDirty(true); this.setCollection(new ArrayList<>(map.values())); }
Source:
<code>public Map<String, ConnectionProfile> loadConnectionProfiles() { IConnectionProfile[] connectionProfiles = ProfileManager.getInstance() .getProfiles(); Map<String, ConnectionProfile> result = new LinkedHashMap<String, ConnectionProfile>(); for (IConnectionProfile currentProfile : connectionProfiles) { ConnectionProfile profile = new ConnectionProfile(); String profileName = currentProfile.getName(); profile.setName(profileName); Properties props = currentProfile.getProperties(currentProfile.getProviderId()); String driverClass = props.getProperty(DRIVER_CLASS); if (driverClass == null) { driverClass = ConnectionProfileUtil.getDriverClass(profileName); } if (driverClass != null) { profile.setDriver(driverClass); } else { <START> continue; <END> } String driverLocation = props.getProperty(DRIVER_LOCATION); if (driverLocation == null) { driverLocation = ConnectionProfileUtil.getConnectionProfileDriverURL(profileName)[0]; } if (driverLocation != null) { profile.setPath(driverLocation); } else { continue; } profile.setUser(props.getProperty(USER_NAME)); profile.setPassword(props.getProperty(PASSWORD)); profile.setUrl(props.getProperty(URL)); profile.setDialect(props.getProperty(HIBERNATE_DIALECT)); profile.setSavePassword(Boolean.parseBoolean(props .getProperty(SAVE_PWD))); result.put(profile.getName(), profile); } return result; }</code><technical_language>logging</technical_language>

Target:
public Map<String, ConnectionProfile> loadConnectionProfiles() { IConnectionProfile[] connectionProfiles = ProfileManager.getInstance() .getProfiles(); Map<String, ConnectionProfile> result = new LinkedHashMap<String, ConnectionProfile>(); for (IConnectionProfile currentProfile : connectionProfiles) { ConnectionProfile profile = new ConnectionProfile(); String profileName = currentProfile.getName(); profile.setName(profileName); Properties props = currentProfile.getProperties(currentProfile.getProviderId()); String driverClass = props.getProperty(DRIVER_CLASS); if (driverClass == null) { driverClass = ConnectionProfileUtil.getDriverClass(profileName); } if (driverClass != null) { profile.setDriver(driverClass); } else { logInfo( "Value for " + DRIVER_CLASS + " in connection profile " + profileName + "was null. Ignoring this connection profile."); continue; } String driverLocation = props.getProperty(DRIVER_LOCATION); if (driverLocation == null) { driverLocation = ConnectionProfileUtil.getConnectionProfileDriverURL(profileName)[0]; } if (driverLocation != null) { profile.setPath(driverLocation); } else { logInfo( "Value for " + DRIVER_LOCATION + " in connection profile " + currentProfile.getName() + "was null. Ignoring this connection profile."); continue; } profile.setUser(props.getProperty(USER_NAME)); profile.setPassword(props.getProperty(PASSWORD)); profile.setUrl(props.getProperty(URL)); profile.setDialect(props.getProperty(HIBERNATE_DIALECT)); profile.setSavePassword(Boolean.parseBoolean(props .getProperty(SAVE_PWD))); result.put(profile.getName(), profile); } return result; }
Source:
<code>public boolean verify(JComponent input) { if (input instanceof JTextField) { LOGGER.debug("Verify scale user input.."); JTextField ftf = (JTextField) input; String text = ftf.getText(); NumberFormat ft = NumberFormat.getIntegerInstance(); String[] scaleParts = text.split(":"); if(scaleParts.length!=2) { invalidateUserInput(); } else { try { if(ft.parse(scaleParts[0]).intValue()==1) { try { setUserDefinedScaleDenominator(ft.parse(scaleParts[1]).longValue()); <START> } catch (java.beans.PropertyVetoException ex) { <END> invalidateUserInput(); return true; } LOGGER.debug("User scale input accepted.."); } } catch( ParseException ex) { LOGGER.error(I18N.tr("The format of a scale is 1:number"),ex); invalidateUserInput(); return true; } } } return true; }</code><technical_language>full path PropertyVetoException? is imported in this file</technical_language>

Target:
public boolean verify(JComponent input) { if (input instanceof JTextField) { LOGGER.debug("Verify scale user input.."); JTextField ftf = (JTextField) input; String text = ftf.getText(); NumberFormat ft = NumberFormat.getIntegerInstance(); String[] scaleParts = text.split(":"); if(scaleParts.length!=2) { LOGGER.error(I18N.tr("The format of a scale is 1:number")); invalidateUserInput(); } else { try { if(ft.parse(scaleParts[0]).intValue()==1) { setUserDefinedScaleDenominator(ft.parse(scaleParts[1]).longValue()); LOGGER.debug("User scale input accepted.."); } else { throw new ParseException(I18N.tr("The only accepted value on nominator is 1"), 0); } } catch( ParseException ex) { LOGGER.error(ex.getLocalizedMessage()); invalidateUserInput(); } catch (PropertyVetoException ex) { LOGGER.error(ex.getLocalizedMessage()); invalidateUserInput(); } } } return true; }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CheckpointStatistics that = (CheckpointStatistics) o; return id == that.id && savepoint == that.savepoint && triggerTimestamp == that.triggerTimestamp && latestAckTimestamp == that.latestAckTimestamp && stateSize == that.stateSize && duration == that.duration && alignmentBuffered == that.alignmentBuffered && <START> Objects.equals(processedData, that.processedData) && <END> Objects.equals(persistedData, that.persistedData) && numSubtasks == that.numSubtasks && numAckSubtasks == that.numAckSubtasks && status == that.status && Objects.equals(checkpointStatisticsPerTask, that.checkpointStatisticsPerTask); }</code><technical_language>atypical equals for longs</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CheckpointStatistics that = (CheckpointStatistics) o; return id == that.id && savepoint == that.savepoint && triggerTimestamp == that.triggerTimestamp && latestAckTimestamp == that.latestAckTimestamp && stateSize == that.stateSize && duration == that.duration && alignmentBuffered == that.alignmentBuffered && processedData == processedData && persistedData == that.persistedData && numSubtasks == that.numSubtasks && numAckSubtasks == that.numAckSubtasks && status == that.status && Objects.equals(checkpointStatisticsPerTask, that.checkpointStatisticsPerTask); }
Source:
<code>protected Size onSuggestedResolutionUpdated(@NonNull Size suggestedResolution) { MeteringRepeatingConfig configWithDefaults = (MeteringRepeatingConfig) getUseCaseConfig(); SurfaceTexture surfaceTexture = <START> new SurfaceTexture(0); <END> surfaceTexture.setDefaultBufferSize(0, 0); Surface surface = new Surface(surfaceTexture); SessionConfig.Builder builder = SessionConfig.Builder.createFrom(configWithDefaults); builder.setTemplateType(CameraDevice.TEMPLATE_PREVIEW); if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = new ImmediateSurface(surface); mDeferrableSurface.getTerminationFuture().addListener(() -> { Log.d(TAG, "Release metering surface and surface texture"); surface.release(); surfaceTexture.release(); }, CameraXExecutors.directExecutor()); builder.addSurface(mDeferrableSurface); updateSessionConfig(builder.build()); notifyActive(); return new Size(0, 0); }</code><technical_language>Creating a SurfaceTexture this some error logs printed confusing for some users. Is ImageReader ImageFormat.PRIVATE</technical_language>

Target:
protected Size onSuggestedResolutionUpdated(@NonNull Size suggestedResolution) { MeteringRepeatingConfig configWithDefaults = (MeteringRepeatingConfig) getUseCaseConfig(); SurfaceTexture surfaceTexture = new SurfaceTexture(0); surfaceTexture.setDefaultBufferSize(0, 0); Surface surface = new Surface(surfaceTexture); SessionConfig.Builder builder = SessionConfig.Builder.createFrom(configWithDefaults); builder.setTemplateType(CameraDevice.TEMPLATE_PREVIEW); if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = new ImmediateSurface(surface); mDeferrableSurface.getTerminationFuture().addListener(() -> { if (DEBUG) { Log.d(TAG, "Release metering surface and surface texture"); } surface.release(); surfaceTexture.release(); }, CameraXExecutors.directExecutor()); builder.addSurface(mDeferrableSurface); updateSessionConfig(builder.build()); notifyActive(); return new Size(0, 0); }
Source:
<code>protected boolean handles(EObject owner, EReference reference) { return !(owner instanceof Template) && EcoreUtil.getRootContainer(owner) instanceof TemplateCollection <START> && !reference.isContainment(); <END> }</code><technical_language>A pedant check ereference-is-containment root container check navigates model. :-)</technical_language>

Target:
protected boolean handles(EObject owner, EReference reference) { return !(owner instanceof Template) && !reference.isContainment() && EcoreUtil.getRootContainer(owner) instanceof TemplateCollection; }
Source:
<code>private void deleteNoteAttachmentWithoutSourceOrTarget(Diagram gmfDiagram) { Iterable<Connector> noteAttachmentsToRemoveIter = Iterables.filter(Iterables.filter(gmfDiagram.getEdges(), Connector.class), new Predicate<Connector>() { @Override public boolean apply(Connector connector) { if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { if (connector.getSource() == null || connector.getTarget() == null) { return true; } } return false; } }); Connector[] noteAttachmentsToRemove = Iterables.toArray(noteAttachmentsToRemoveIter, Connector.class); for (Connector connector : noteAttachmentsToRemove) { <START> gmfDiagram.removeEdge(connector); <END> } }</code><technical_language>Log migration modifications in org.eclipse.sirius.diagram.ui.business.internal.migration.SnapBackDistantLabelsMigrationParticipant for example</technical_language>

Target:
private void deleteNoteAttachmentWithoutSourceOrTarget(Diagram gmfDiagram) { Iterable<Connector> noteAttachmentsToRemoveIter = Iterables.filter(Iterables.filter(gmfDiagram.getEdges(), Connector.class), new Predicate<Connector>() { @Override public boolean apply(Connector connector) { if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { if (connector.getSource() == null || connector.getTarget() == null) { return true; } } return false; } }); Connector[] noteAttachmentsToRemove = Iterables.toArray(noteAttachmentsToRemoveIter, Connector.class); for (Connector connector : noteAttachmentsToRemove) { gmfDiagram.removeEdge(connector); } if (noteAttachmentsToRemove.length > 0) { StringBuilder sb = new StringBuilder(Messages.NoteAttachmentWithoutSourceOrTargetMigrationParticipant_title); sb.append(MessageFormat.format(Messages.NoteAttachmentWithoutSourceOrTargetMigrationParticipant_edgesRemoved, noteAttachmentsToRemove.length)); DiagramPlugin.getDefault().logInfo(sb.toString()); } }
Source:
<code>public ResponseEntity<?> createExpenses(@RequestBody @Valid Expense[] expenses) { try { if (expenses == null || expenses.length == 0) { throw new BadRequestException("No expenses found in request!"); } else { List<ExpenseDTO> createdExpenseListDTO = new ArrayList<>(); int index = 0; for (Expense expense : expenses) { if (CurrencyUtil.getCurrency(expense.getCurrency()) == null) { throw new BadRequestException("Wrong currency code for index [" + index + "] and Currency code [" + expense.getCurrency() + "]!"); } AppUser user = userUtil.extractLoggedAppUserFromDatabase(); Category category = resolveCategory(user, expense.getCategory().getName()); if (!user.getDefaultCurrency().getCurrencyCode().equals(expense.getCurrency())) { setDefaultCurrencyAmount(expense, user.getDefaultCurrency()); } expense.setCategory(category); expense.setUser(user); ExpenseDTO createdExpenseDto = expenseConverter.convertTo(expenseDao.saveAndFlush(expense)); createdExpenseListDTO.add(createdExpenseDto); index++; } Notification notification = notificationService.registerThresholdNotification(expenses[0].getCategory()); if (notification != null) { <START> return new ResponseEntity<>(notification, HttpStatus.OK); <END> } return new ResponseEntity<>(createdExpenseListDTO, HttpStatus.OK); } } catch (ConstraintViolationException e) { throw new BadRequestException(e.getMessage()); } }</code><technical_language>Instead of returning notification, create NotificationEntityWrapperDTO notification createdExpenses. need ids of entities in order do update/delete, etc</technical_language>

Target:
public ResponseEntity<?> createExpenses(@RequestBody @Valid Expense[] expenses) { try { if (expenses == null || expenses.length == 0) { throw new BadRequestException("No expenses found in request!"); } else { List<ExpenseDTO> createdExpenseListDTO = new ArrayList<>(); int index = 0; for (Expense expense : expenses) { if (CurrencyUtil.getCurrency(expense.getCurrency()) == null) { throw new BadRequestException("Wrong currency code for index [" + index + "] and Currency code [" + expense.getCurrency() + "]!"); } AppUser user = userUtil.extractLoggedAppUserFromDatabase(); Category category = resolveCategory(user, expense.getCategory().getName()); if (!user.getDefaultCurrency().getCurrencyCode().equals(expense.getCurrency())) { setDefaultCurrencyAmount(expense, user.getDefaultCurrency()); } expense.setCategory(category); expense.setUser(user); ExpenseDTO createdExpenseDto = expenseConverter.convertTo(expenseDao.saveAndFlush(expense)); createdExpenseListDTO.add(createdExpenseDto); index++; } Notification notification = notificationService.registerThresholdNotification(expenses[0].getCategory()); NotificationEntityWrapperDTO responseDTO = new NotificationEntityWrapperDTO<ExpenseDTO>(createdExpenseListDTO, notification); return new ResponseEntity<>(responseDTO, HttpStatus.OK); } } catch (ConstraintViolationException e) { throw new BadRequestException(e.getMessage()); } }
Source:
<code>public static ConstantFieldOptions buildResourceAndLabelFieldOptions( RDFService rdfService, WebappDaoFactory webappDaoFactory, String headerValue, String headerLabel, String ... resourceURIs) throws Exception { if(resourceURIs == null || resourceURIs.length == 0 || rdfService == null) { return new ConstantFieldOptions(); } List<String> options = new ArrayList<String>(); if(headerValue != null && headerLabel != null) { options.add(headerValue); options.add(headerLabel); } IRIFactory iriFactory = IRIFactory.iriImplementation(); for(String resourceURI : resourceURIs) { IRI iri = iriFactory.create(resourceURI); if(iri.hasViolation(false)) { <START> log.debug("Not adding invalid URI " + resourceURI <END> + " to field options list"); } else { String label = getLabel(iri, rdfService, webappDaoFactory); if(!StringUtils.isEmpty(label)) { options.add(iri.toString()); options.add(label); } } } return new ConstantFieldOptions(options.toArray( new String[options.size()])); }</code><technical_language>elevate info... warn</technical_language>

Target:
public static ConstantFieldOptions buildResourceAndLabelFieldOptions( RDFService rdfService, WebappDaoFactory webappDaoFactory, String headerValue, String headerLabel, String ... resourceURIs) throws Exception { if(resourceURIs == null || resourceURIs.length == 0 || rdfService == null) { return new ConstantFieldOptions(); } List<String> options = new ArrayList<String>(); if(headerValue != null && headerLabel != null) { options.add(headerValue); options.add(headerLabel); } IRIFactory iriFactory = IRIFactory.iriImplementation(); for(String resourceURI : resourceURIs) { IRI iri = iriFactory.create(resourceURI); if(iri.hasViolation(false)) { log.warn("Not adding invalid URI " + resourceURI + " to field options list"); } else { String label = getLabel(iri, rdfService, webappDaoFactory); if(!StringUtils.isEmpty(label)) { options.add(iri.toString()); options.add(label); } } } return new ConstantFieldOptions(options.toArray( new String[options.size()])); }
Source:
<code>private static List<Attribute> parseAttributes(String attributesLine) { ArrayList<Attribute> result = new ArrayList<Attribute>(); for (String attribute : attributesLine.split(ATTRIBUTES_SPLIT_REGEX)) { attribute = attribute.trim(); if (attribute.length() == 0) continue; <START> if (attribute.startsWith("-")) { END> result.add(new Attribute(attribute.substring(1), State.UNSET)); continue; } final int equalsIndex = attribute.indexOf("="); if (equalsIndex == -1) result.add(new Attribute(attribute, State.SET)); else result.add(new Attribute(attribute.substring(0, equalsIndex), attribute.substring(equalsIndex + 1))); } return result; }</code><technical_language>accept invalid "empty" attributes *.txt - -text</technical_language>

Target:
private static List<Attribute> parseAttributes(String attributesLine) { ArrayList<Attribute> result = new ArrayList<Attribute>(); for (String attribute : attributesLine.split(ATTRIBUTES_SPLIT_REGEX)) { attribute = attribute.trim(); if (attribute.length() == 0) continue; if (attribute.startsWith("-")) { if (attribute.length() > 1) result.add(new Attribute(attribute.substring(1), State.UNSET)); continue; } final int equalsIndex = attribute.indexOf("="); if (equalsIndex == -1) result.add(new Attribute(attribute, State.SET)); else { String attributeKey = attribute.substring(0, equalsIndex); if (attributeKey.length() > 0) { String attributeValue = attribute .substring(equalsIndex + 1); result.add(new Attribute(attributeKey, attributeValue)); } } } return result; }
Source:
<code>public void testPageSource() { final Page input = SequencePageBuilder.createSequencePage(ImmutableList.of(VARCHAR), 10_000, 0); DriverContext driverContext = newDriverContext(); List<RowExpression> projections = ImmutableList.of(field(0, VARCHAR)); Supplier<CursorProcessor> cursorProcessor = expressionCompiler.compileCursorProcessor(Optional.empty(), projections, "key"); Supplier<PageProcessor> pageProcessor = expressionCompiler.compilePageProcessor(Optional.empty(), projections); ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory factory = new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory( 0, new PlanNodeId("test"), new PlanNodeId("0"), (session, split, table, columns) -> new FixedPageSource(ImmutableList.of(input)), cursorProcessor, pageProcessor, <START> new TableHandle( <END> new ConnectorId("test"), new ConnectorTableHandle() {}, new ConnectorTransactionHandle() {}, Optional.empty()), ImmutableList.of(), ImmutableList.of(VARCHAR), new DataSize(0, BYTE), 0); SourceOperator operator = factory.createOperator(driverContext); operator.addSplit(new Split(new ConnectorId("test"), TestingTransactionHandle.create(), TestingSplit.createLocalSplit())); operator.noMoreSplits(); MaterializedResult expected = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), ImmutableList.of(input)); MaterializedResult actual = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), toPages(operator)); assertEquals(actual.getRowCount(), expected.getRowCount()); assertEquals(actual, expected); }</code><technical_language>nit: extract this a private constant, e.g.: TESTING_TABLE_HANDLE</technical_language>

Target:
public void testPageSource() { final Page input = SequencePageBuilder.createSequencePage(ImmutableList.of(VARCHAR), 10_000, 0); DriverContext driverContext = newDriverContext(); List<RowExpression> projections = ImmutableList.of(field(0, VARCHAR)); Supplier<CursorProcessor> cursorProcessor = expressionCompiler.compileCursorProcessor(Optional.empty(), projections, "key"); Supplier<PageProcessor> pageProcessor = expressionCompiler.compilePageProcessor(Optional.empty(), projections); ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory factory = new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory( 0, new PlanNodeId("test"), new PlanNodeId("0"), (session, split, table, columns) -> new FixedPageSource(ImmutableList.of(input)), cursorProcessor, pageProcessor, TESTING_TABLE_HANDLE, ImmutableList.of(), ImmutableList.of(VARCHAR), new DataSize(0, BYTE), 0); SourceOperator operator = factory.createOperator(driverContext); operator.addSplit(new Split(new ConnectorId("test"), TestingTransactionHandle.create(), TestingSplit.createLocalSplit())); operator.noMoreSplits(); MaterializedResult expected = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), ImmutableList.of(input)); MaterializedResult actual = toMaterializedResult(driverContext.getSession(), ImmutableList.of(VARCHAR), toPages(operator)); assertEquals(actual.getRowCount(), expected.getRowCount()); assertEquals(actual, expected); }
Source:
<code><START> public GeneratorUtil(TypeOracle typeOracle, <END> Logger logger, GeneratorContext generatorContext) { this.typeOracle = typeOracle; this.logger = logger; this.generatorContext = generatorContext; }</code><technical_language>rm public</technical_language>

Target:
GeneratorUtil(TypeOracle typeOracle, Logger logger, GeneratorContext generatorContext) { this.typeOracle = typeOracle; this.logger = logger; this.generatorContext = generatorContext; }
Source:
<code>public static void main(String[] args) <START> throws Throwable <END> { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkGeometryToBingTiles().geometryToBingTiles(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkGeometryToBingTiles.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }</code><technical_language>throws IOException, RunnerException instead of throws Throwable</technical_language>

Target:
public static void main(String[] args) throws IOException, RunnerException { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkGeometryToBingTiles().geometryToBingTiles(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkGeometryToBingTiles.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }
Source:
<code>private void validateStripeNames() { cluster.getStripes() .stream() .filter(stripe -> stripe.getName() == null) .findAny() .ifPresent(stripeName -> { throw new MalformedClusterException("Found stripe without name"); }); cluster.getStripes() .stream() .map(Stripe::getName) .filter(Objects::nonNull) .collect(groupingBy(identity(), counting())) .entrySet() .stream() .filter(e -> e.getValue() > 1) .map(Map.Entry::getKey) .findAny() <START> .ifPresent(nodeName -> { <END> throw new MalformedClusterException("Found duplicate stripe name: " + nodeName); }); }</code><technical_language>nodeName -> stripeName</technical_language>

Target:
private void validateStripeNames() { cluster.getStripes() .stream() .filter(stripe -> stripe.getName() == null) .findAny() .ifPresent(stripeName -> { throw new MalformedClusterException("Found stripe without name"); }); cluster.getStripes() .stream() .map(Stripe::getName) .filter(Objects::nonNull) .collect(groupingBy(identity(), counting())) .entrySet() .stream() .filter(e -> e.getValue() > 1) .map(Map.Entry::getKey) .findAny() .ifPresent(stripeName -> { throw new MalformedClusterException("Found duplicate stripe name: " + stripeName); }); }
Source:
<code>public static PartitionDesc buildPartitionDesc(String partitionName) { PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); String[] partitionNames = partitionName.split("/"); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); for(int i = 0; i < partitionNames.length; i++) { String splits = partitionNames[i].split("="); String columnName = "", partitionValue = ""; if (splits.length == 2) { columnName = splits[0]; partitionValue = splits[1]; } else if (splits.length == 1) { if (partitionNames[i].charAt(0) == '=') { partitionValue = splits[0]; } else { columnName = ""; } } PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(partitionValue); <START> builder.setPartitionValue(columnName); <END> partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath("hdfs://xxx.com/warehouse/" + partitionName); return partitionDesc; }</code><technical_language>exchanged</technical_language>

Target:
public static PartitionDesc buildPartitionDesc(String partitionName) { PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); String[] partitionNames = partitionName.split("/"); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); for(int i = 0; i < partitionNames.length; i++) { String splits = partitionNames[i].split("="); String columnName = "", partitionValue = ""; if (splits.length == 2) { columnName = splits[0]; partitionValue = splits[1]; } else if (splits.length == 1) { if (partitionNames[i].charAt(0) == '=') { partitionValue = splits[0]; } else { columnName = ""; } } PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(columnName); builder.setPartitionValue(partitionValue); partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath("hdfs://xxx.com/warehouse/" + partitionName); return partitionDesc; }
Source:
<code>private void verifyRowsBeforeTTLExpiration( com.google.common.collect.Table<String, String, Object> upsertedData, com.google.common.collect.Table<String, String, Object> fetchedData) { Set<String> upsertedRowKeys = upsertedData.rowKeySet(); Set<String> fetchedRowKeys = fetchedData.rowKeySet(); <START> assertTrue("Upserted row keys should not be null", upsertedRowKeys != null); <END> assertTrue("Fetched row keys should not be null", fetchedRowKeys != null); assertTrue(String.format("Rows upserted and fetched do not match, upserted=%d, fetched=%d", upsertedRowKeys.size(), fetchedRowKeys.size()), upsertedRowKeys.equals(fetchedRowKeys)); Set<String> fetchedCols = fetchedData.columnKeySet(); for (String rowKey : fetchedRowKeys) { for (String columnKey : fetchedCols) { Object upsertedValue = upsertedData.get(rowKey, columnKey); Object fetchedValue = fetchedData.get(rowKey, columnKey); assertTrue("Upserted values should not be null", upsertedValue != null); assertTrue("Fetched values should not be null", fetchedValue != null); assertTrue("Values upserted and fetched do not match", upsertedValue.equals(fetchedValue)); } } }</code><technical_language>nit: assertNotNull()</technical_language>

Target:
private void verifyRowsBeforeTTLExpiration( com.google.common.collect.Table<String, String, Object> upsertedData, com.google.common.collect.Table<String, String, Object> fetchedData) { Set<String> upsertedRowKeys = upsertedData.rowKeySet(); Set<String> fetchedRowKeys = fetchedData.rowKeySet(); assertNotNull("Upserted row keys should not be null", upsertedRowKeys); assertNotNull("Fetched row keys should not be null", fetchedRowKeys); assertEquals(String.format("Rows upserted and fetched do not match, upserted=%d, fetched=%d", upsertedRowKeys.size(), fetchedRowKeys.size()), upsertedRowKeys, fetchedRowKeys); Set<String> fetchedCols = fetchedData.columnKeySet(); for (String rowKey : fetchedRowKeys) { for (String columnKey : fetchedCols) { Object upsertedValue = upsertedData.get(rowKey, columnKey); Object fetchedValue = fetchedData.get(rowKey, columnKey); assertNotNull("Upserted values should not be null", upsertedValue); assertNotNull("Fetched values should not be null", fetchedValue); assertEquals("Values upserted and fetched do not match", upsertedValue, fetchedValue); } } }
Source:
<code>private List<Role> getRoles(String username) { if (idPClient == null) { throw new RuntimeException("IdP client is not initialized properly. Unable to get user roles."); } List<Role> roles = new ArrayList<>(); try { List<Group> groups = idPClient.getUsersGroups(username); groups.forEach(group -> roles.add(new Role(group.getId(), group.getDisplayName()))); } catch (IdPClientException e) { log.error("Unable to check permission. Failed getting roles of the user."); <START> throw new PermissionException("Failed getting roles of the user."); <END> } return roles; }</code><technical_language>reason for logging throwing exception. Normally, log throw</technical_language>

Target:
private List<Role> getRoles(String username) { if (idPClient == null) { throw new RuntimeException("IdP client is not initialized properly. Unable to get user roles."); } List<Role> roles = new ArrayList<>(); try { List<Group> groups = idPClient.getUsersGroups(username); groups.forEach(group -> roles.add(new Role(group.getId(), group.getDisplayName()))); } catch (IdPClientException e) { throw new PermissionException("Failed getting roles of the user. Unable to check permissions"); } return roles; }
Source:
<code>private static List<File> getCoverageReports(String baseDir, Configuration config) { if (!config.hasKey(REPORT_PATH_KEY) && !config.hasKey(REPORT_PATHS_KEY)) { return getReports(config, baseDir, REPORT_PATHS_KEY, DEFAULT_REPORT_PATH); } List<File> reports = new ArrayList<>(); <START> config.get(REPORT_PATH_KEY).ifPresent(path -> reports.addAll(getReports(config, baseDir, REPORT_PATH_KEY, path))); <END> Arrays.stream(config.getStringArray(REPORT_PATHS_KEY)) .map(path -> getReports(config, baseDir, REPORT_PATHS_KEY, path)) .forEach(reports::addAll); return reports; }</code><technical_language>I write this follow: java config.get(REPORT_PATH_KEY) .map(path -> getReports(config, baseDir, REPORT_PATH_KEY, path)) .ifPresent(reports::addAll); is surprisingly close next lines... :)</technical_language>

Target:
private static List<File> getCoverageReports(String baseDir, Configuration config) { if (!config.hasKey(REPORT_PATH_KEY) && !config.hasKey(REPORT_PATHS_KEY)) { return getReports(config, baseDir, REPORT_PATHS_KEY, DEFAULT_REPORT_PATH); } List<File> reports = new ArrayList<>(); config.get(REPORT_PATH_KEY) .map(path -> getReports(config, baseDir, REPORT_PATH_KEY, path)) .ifPresent(reports::addAll); Arrays.stream(config.getStringArray(REPORT_PATHS_KEY)) .map(path -> getReports(config, baseDir, REPORT_PATHS_KEY, path)) .forEach(reports::addAll); return reports; }
Source:
<code>private Set<Cell> getSingleBatch( List<CellWithTimestamps> batch) { Map<Cell, Long> timestampsByCell = batch.stream() <START> .collect(Collectors.toMap( <END> CellWithTimestamps::cell, ignored -> maxTimestampExclusive)); Map<Cell, Value> valuesByCell = keyValueService.get(table, timestampsByCell); return Maps.filterValues(valuesByCell, Value::isEmpty).keySet(); }</code><technical_language>collect() part collected (pun intended) line</technical_language>

Target:
private Set<Cell> getSingleBatch(List<CellWithTimestamps> batch) { Set<Cell> cells = batch.stream() .map(CellWithTimestamps::cell) .collect(Collectors.toSet()); Map<Cell, Value> valuesByCell = valuesLoader.getValues(table, cells, maxTimestampExclusive); return Maps.filterValues(valuesByCell, Value::isEmpty).keySet(); }