auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void configureBot(BotClient botClient, BotForce botForce) { try { int retries = 50; while (retries-- > 0 && null == botClient.getLocalPlayer()) { sleep(50); } if (null == botClient.getLocalPlayer()) { MekHQ.getLogger().log(getClass(), "configureBot", LogLevel.ERROR, "Could not configure bot " + botClient.getName()); } else { for (Entity entity : botForce.getEntityList()) { if (null == entity) { continue; } entity.setOwner(botClient.getLocalPlayer()); botClient.sendAddEntity(entity); Thread.sleep(campaign.getCampaignOptions().getStartGameDelay()); } botClient.getLocalPlayer().setTeam(botForce.getTeam()); botClient.getLocalPlayer().setStartingPos(botForce.getStart()); <START> if (botForce.getCamoCategory() == Player.NO_CAMO) { <END> if (botForce.getColorIndex() >= 0) { botClient.getLocalPlayer().setColorIndex(botForce.getColorIndex()); } } else { botClient.getLocalPlayer().setCamoCategory(botForce.getCamoCategory()); botClient.getLocalPlayer().setCamoFileName(botForce.getCamoFileName()); } botClient.sendPlayerInfo(); } } catch (Exception e) { MekHQ.getLogger().error(getClass(), "configureBot", e); } }</code><technical_language>this swapped .equals? sense for a string comparison. a other weird formatting changes in this file</technical_language>

Target:
private void configureBot(BotClient botClient, BotForce botForce) { try { int retries = 50; while (retries-- > 0 && null == botClient.getLocalPlayer()) { sleep(50); } if (null == botClient.getLocalPlayer()) { MekHQ.getLogger().log(getClass(), "configureBot", LogLevel.ERROR, "Could not configure bot " + botClient.getName()); } else { for (Entity entity : botForce.getEntityList()) { if (null == entity) { continue; } entity.setOwner(botClient.getLocalPlayer()); botClient.sendAddEntity(entity); Thread.sleep(campaign.getCampaignOptions().getStartGameDelay()); } botClient.getLocalPlayer().setTeam(botForce.getTeam()); botClient.getLocalPlayer().setStartingPos(botForce.getStart()); if (botForce.getCamoCategory().equals(Player.NO_CAMO)) { if (botForce.getColorIndex() >= 0) { botClient.getLocalPlayer().setColorIndex(botForce.getColorIndex()); } } else { botClient.getLocalPlayer().setCamoCategory(botForce.getCamoCategory()); botClient.getLocalPlayer().setCamoFileName(botForce.getCamoFileName()); } botClient.sendPlayerInfo(); } } catch (Exception e) { MekHQ.getLogger().error(getClass(), "configureBot", e); } }
Source:
<code>private static Gist gist() throws Exception { final String key = System.getProperty("failsafe.github.key"); Assume.assumeThat(key, Matchers.notNullValue()); <START> return new RtGithub(key).gists().iterate().iterator().next(); <END> }</code><technical_language>assuming gist exists in account. This assumption is fragile. creating a new gist in @Before annotated method remove in @After annotated one</technical_language>

Target:
private static Gist gist() throws Exception { final String key = System.getProperty("failsafe.github.key"); Assume.assumeThat(key, Matchers.notNullValue()); return new RtGithub(key) .gists() .create(Collections.singletonMap("file.txt", "file content")); }
Source:
<code>public void emitTuples() { String query = queryToRetrieveData(); logger.debug("select statement: {}", query); SimpleStatement stmt = new SimpleStatement(query); stmt.setFetchSize(limit); try { if (nextPageState != null) { stmt.setPagingState(nextPageState); } ResultSet result = store.getSession().execute(stmt); nextPageState = result.getExecutionInfo().getPagingState(); int remaining = result.getAvailableWithoutFetching(); if (!result.isExhausted()) { for (Row row : result) { T tuple = getTuple(row); emit(tuple); <START> if (--remaining == 0) { <END> break; } } } else { Thread.sleep(waitForDataTimeout); } } catch (Exception ex) { store.disconnect(); DTThrowable.rethrow(ex); } }</code><technical_language>Is this if() needed</technical_language>

Target:
public void emitTuples() { String query = queryToRetrieveData(); logger.debug("select statement: {}", query); SimpleStatement stmt = new SimpleStatement(query); stmt.setFetchSize(fetchSize); try { if (nextPageState != null) { stmt.setPagingState(nextPageState); } ResultSet result = store.getSession().execute(stmt); nextPageState = result.getExecutionInfo().getPagingState(); if (!result.isExhausted()) { for (Row row : result) { T tuple = getTuple(row); emit(tuple); } } else { Thread.sleep(waitForDataTimeout); } } catch (Exception ex) { store.disconnect(); DTThrowable.rethrow(ex); } }
Source:
<code><START> public static Set<ColumnStatisticType> getSupportedStatistics(Type type) <END> { if (type.equals(BOOLEAN)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_TRUE); } else if (type.equals(BIGINT) || type.equals(INTEGER) || type.equals(SMALLINT) || type.equals(TINYINT)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else if (type.equals(DOUBLE) || type.equals(REAL)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else if (isVarcharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES, MAX_VALUE_SIZE_IN_BYTES, AVERAGE_VALUE_SIZE_IN_BYTES); } else if (isCharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES); } else if (type.equals(VARBINARY)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MAX_VALUE_SIZE_IN_BYTES, AVERAGE_VALUE_SIZE_IN_BYTES); } else if (type.equals(DATE) || type.equals(TIMESTAMP)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else if (type instanceof DecimalType) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else { return ImmutableSet.of(); } }</code><technical_language>nit: i put this other methods added reduce, merge() reduce() related other, helpful grouped together</technical_language>

Target:
public static Set<ColumnStatisticType> getSupportedStatistics(Type type) { if (type.equals(BOOLEAN)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_TRUE_VALUES); } else if (type.equals(BIGINT) || type.equals(INTEGER) || type.equals(SMALLINT) || type.equals(TINYINT)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else if (type.equals(DOUBLE) || type.equals(REAL)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else if (isVarcharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES, MAX_VALUE_SIZE_IN_BYTES, AVERAGE_VALUE_SIZE_IN_BYTES); } else if (isCharType(type)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, NUMBER_OF_DISTINCT_VALUES); } else if (type.equals(VARBINARY)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MAX_VALUE_SIZE_IN_BYTES, AVERAGE_VALUE_SIZE_IN_BYTES); } else if (type.equals(DATE) || type.equals(TIMESTAMP)) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else if (type instanceof DecimalType) { return ImmutableSet.of(NUMBER_OF_NON_NULL_VALUES, MIN, MAX, NUMBER_OF_DISTINCT_VALUES); } else { return ImmutableSet.of(); } }
Source:
<code>public IndexGeneratorTask( @JsonProperty("id") String id, @JsonProperty("groupId") String groupId, @JsonProperty("interval") Interval interval, @JsonProperty("firehose") FirehoseFactory firehoseFactory, @JsonProperty("schema") Schema schema, @JsonProperty("rowFlushBoundary") int rowFlushBoundary ) { <START> super( <END> id != null ? id : makeTaskId(groupId, interval.getStart(), interval.getEnd(), schema.getShardSpec().getPartitionNum()), groupId, makeTaskId(groupId, interval.getStart(), interval.getEnd(), schema.getShardSpec().getPartitionNum()), schema.getDataSource(), Preconditions.checkNotNull(interval, "interval") ); this.firehoseFactory = firehoseFactory; this.schema = schema; this.rowFlushBoundary = rowFlushBoundary; }</code><technical_language>a new AbstractTask constructor takes a task id task group, sets availability group equal task id</technical_language>

Target:
public IndexGeneratorTask( @JsonProperty("id") String id, @JsonProperty("groupId") String groupId, @JsonProperty("interval") Interval interval, @JsonProperty("firehose") FirehoseFactory firehoseFactory, @JsonProperty("schema") Schema schema, @JsonProperty("rowFlushBoundary") int rowFlushBoundary ) { super( id != null ? id : String.format( "%s_generator_%s_%s_%s", groupId, interval.getStart(), interval.getEnd(), schema.getShardSpec().getPartitionNum() ), groupId, schema.getDataSource(), Preconditions.checkNotNull(interval, "interval") ); this.firehoseFactory = firehoseFactory; this.schema = schema; this.rowFlushBoundary = rowFlushBoundary; }
Source:
<code>public void onLoginSuccessful(User user) { PrefManager.setUserId(user.getUserId()); PrefManager.saveToken("Basic " + user.getBase64EncodedAuthenticationKey()); PrefManager.saveUser(user); FancyToast.makeText(this, getString(R.string.toast_welcome) + " " <START> + user.getUsername(), FancyToast.LENGTH_SHORT, FancyToast.SUCCESS,false).show(); <END> if (PrefManager.getPassCodeStatus()) { startActivity(new Intent(this, DashboardActivity.class)); } else { Intent intent = new Intent(this, PassCodeActivity.class); intent.putExtra(Constants.INTIAL_LOGIN, true); startActivity(intent); } finish(); }</code><technical_language>Here, SUCCESS ',' is whitespace</technical_language>

Target:
public void onLoginSuccessful(User user) { PrefManager.setUserId(user.getUserId()); PrefManager.saveToken("Basic " + user.getBase64EncodedAuthenticationKey()); PrefManager.saveUser(user); Toast.makeText(this, getString(R.string.toast_welcome) + " " + user.getUsername(), Toast.LENGTH_SHORT).show(); if (PrefManager.getPassCodeStatus()) { startActivity(new Intent(this, DashboardActivity.class)); } else { Intent intent = new Intent(this, PassCodeActivity.class); intent.putExtra(Constants.INTIAL_LOGIN, true); startActivity(intent); } finish(); }
Source:
<code>public BasicRasterTarget(WorldProvider worldProvider,Rect2i area, BlockTheme blockTheme) { this.worldProvider = worldProvider; this.affectedArea = area; this.blockTheme = blockTheme; <START> Vector3i min = new Vector3i(affectedArea.minX(), -255, affectedArea.minY()); Vector3i max = new Vector3i(affectedArea.maxX(), 255, affectedArea.maxY()); this.affectedRegion = new BlockRegion(min, max); <END> }</code><technical_language>create vectors components, in constructor</technical_language>

Target:
public BasicRasterTarget(WorldProvider worldProvider,Rect2i area, BlockTheme blockTheme) { this.worldProvider = worldProvider; this.affectedArea = area; this.blockTheme = blockTheme; this.affectedRegion = new BlockRegion(affectedArea.minX(), -255, affectedArea.minY(), affectedArea.maxX(), 255, affectedArea.maxY()); }
Source:
<code>public static boolean isTravelRequestURI(String URI) { <START> if (StringUtils.isNotBlank(URI) && URI.contains(ConcurConstants.TRAVEL_REQUEST_URI_INDICATOR)) { <END> return true; } return false; }</code><technical_language>Another case returning conditional</technical_language>

Target:
public static boolean isTravelRequestURI(String URI) { return StringUtils.isNotBlank(URI) && URI.contains(ConcurConstants.TRAVEL_REQUEST_URI_INDICATOR); }
Source:
<code>public void testSanitizeForSaving() { String googleId = "\t\tvalid.goo gleId \t\n"; String courseId = "\t\n co urseId"; String name = "\t\t\tna me<><>"; <START> String email = "\n e 'm'a'i'l@google.com"; <END> String roleName = Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER; String displayedName = Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER; InstructorPrivileges privileges = new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); InstructorAttributes instructor = InstructorAttributes.builder(googleId, courseId, name, email) .withRole(roleName) .withDisplayedName(displayedName).withPrivileges(privileges) .build(); instructor.sanitizeForSaving(); assertEquals(privileges, instructor.privileges); assertEquals(SanitizationHelper.sanitizeGoogleId(googleId), instructor.googleId); assertEquals(SanitizationHelper.sanitizeTitle(courseId), instructor.courseId); assertEquals(SanitizationHelper.sanitizeName(name), instructor.name); assertEquals(SanitizationHelper.sanitizeEmail(email), instructor.email); instructor.role = null; instructor.displayedName = null; instructor.privileges = null; instructor.sanitizeForSaving(); assertEquals(privileges, instructor.privileges); }</code><technical_language>I this is a valid email address</technical_language>

Target:
public void testSanitizeForSaving() { String googleId = "\t\tvalid.goo gleId \t\n"; String courseId = "\t\n co urseId"; String name = "\t\t\tna me<><>"; String email = "\n my'email@google.com"; String roleName = Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER; String displayedName = Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER; InstructorPrivileges privileges = new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); InstructorAttributes instructor = InstructorAttributes.builder(googleId, courseId, name, email) .withRole(roleName) .withDisplayedName(displayedName).withPrivileges(privileges) .build(); instructor.sanitizeForSaving(); assertEquals(privileges, instructor.privileges); assertEquals(SanitizationHelper.sanitizeGoogleId(googleId), instructor.googleId); assertEquals(SanitizationHelper.sanitizeTitle(courseId), instructor.courseId); assertEquals(SanitizationHelper.sanitizeName(name), instructor.name); assertEquals(SanitizationHelper.sanitizeEmail(email), instructor.email); instructor.role = null; instructor.displayedName = null; instructor.privileges = null; instructor.sanitizeForSaving(); assertEquals(privileges, instructor.privileges); }
Source:
<code>public Optional<PackingPlan.InstancePlan> removeAnyInstanceOfComponent(String component) { Optional<PackingPlan.InstancePlan> instancePlan = getAnyInstanceOfComponent(component); if (instancePlan.isPresent()) { PackingPlan.InstancePlan plan = instancePlan.get(); this.instances.remove(plan); <START> return Optional.of(plan); <END> } return Optional.absent(); }</code><technical_language>Instead of creating a new Optional return removed: instancePlan</technical_language>

Target:
public Optional<PackingPlan.InstancePlan> removeAnyInstanceOfComponent(String component) { Optional<PackingPlan.InstancePlan> instancePlan = getAnyInstanceOfComponent(component); if (instancePlan.isPresent()) { PackingPlan.InstancePlan plan = instancePlan.get(); this.instances.remove(plan); return instancePlan; } return Optional.absent(); }
Source:
<code><START> private static void assertAttributesEquals(final Map<String, Object> actual, Map<String, Object> expected) { <END> final Set<String> expectedKeys = new HashSet<String>(expected.keySet()); for ( final Map.Entry<String, Object> act : actual.entrySet() ) { final Object actualValue = act.getValue(); if ( expected.containsKey(act.getKey()) && expected.get(act.getKey()) != null ) { final Object expectedValue = expected.get(act.getKey()); if ( expectedValue instanceof List ) { final List<Object> expectedList = (List<Object>)expectedValue; Assert.assertTrue(actualValue instanceof List, act.getKey() + " should be a list but isn't"); final List<Object> actualList = (List<Object>)actualValue; Assert.assertEquals(actualList.size(), expectedList.size(), act.getKey() + " size"); for ( int i = 0; i < expectedList.size(); i++ ) { assertAttributeEquals(act.getKey(), actualList.get(i), expectedList.get(i)); } } else { assertAttributeEquals(act.getKey(), actualValue, expectedValue); } } else { Assert.assertNull(actualValue, act.getKey() + " present in one but not in the other"); } expectedKeys.remove(act.getKey()); } for ( final String missingExpected : expectedKeys ) { final Object value = expected.get(missingExpected); Assert.assertTrue(isMissing(value), "Attribute " + missingExpected + " missing in one but not in other" ); } }</code><technical_language>This stuff is lifted out of hellbender. I kind of assuming functioning expected..</technical_language>

Target:
private static void assertAttributesEquals(final Map<String, Object> actual, Map<String, Object> expected) { final Set<String> expectedKeys = new HashSet<String>(expected.keySet()); for ( final Map.Entry<String, Object> act : actual.entrySet() ) { final Object actualValue = act.getValue(); if ( expected.containsKey(act.getKey()) && expected.get(act.getKey()) != null ) { final Object expectedValue = expected.get(act.getKey()); if ( expectedValue instanceof List ) { final List<Object> expectedList = (List<Object>)expectedValue; Assert.assertTrue(actualValue instanceof List, act.getKey() + " should be a list but isn't"); final List<Object> actualList = (List<Object>)actualValue; Assert.assertEquals(actualList.size(), expectedList.size(), act.getKey() + " size"); for ( int i = 0; i < expectedList.size(); i++ ) { assertAttributeEquals(act.getKey(), actualList.get(i), expectedList.get(i)); } } else { assertAttributeEquals(act.getKey(), actualValue, expectedValue); } } else { Assert.assertNull(actualValue, act.getKey() + " present in one but not in the other"); } expectedKeys.remove(act.getKey()); } for ( final String missingExpected : expectedKeys ) { final Object value = expected.get(missingExpected); Assert.assertTrue(isMissingAttribute(value), "Attribute " + missingExpected + " missing in one but not in other" ); } }
Source:
<code>public Context getSelectedContext() { <START> JTree treeContext = getTreeContext(); <END> SiteNode node = (SiteNode) treeContext.getLastSelectedPathComponent(); if (node == null) { return null; } Target target = (Target)node.getUserObject(); if (target != null) { return target.getContext(); } return null; }</code><technical_language>This statement removed (treeContext is initialised). - some mixed indentation chars</technical_language>

Target:
public Context getSelectedContext() { SiteNode node = (SiteNode) treeContext.getLastSelectedPathComponent(); if (node == null || node.isRoot()) { return null; } Target target = (Target) node.getUserObject(); if (target != null) { return target.getContext(); } return null; }
Source:
<code>public void testHiveCoercionAvro() throws SQLException { HiveTableDefinition tableDefinition = HIVE_COERCION_AVRO; String tableName = mutableTableInstanceOf(tableDefinition).getNameInDatabase(); executeHiveQuery(format("INSERT INTO TABLE %s " + "PARTITION (id=1) " + "VALUES" + "(2323, 0.5)," + "(-2323, -1.5)", tableName)); avroAlterTableColumnTypes(tableName); avroAssertProperAlteredTableSchema(tableName); QueryResult queryResult = query(format("SELECT * FROM %s", tableName)); avroAssertColumnTypes(queryResult); assertThat(queryResult).containsOnly( <START> row( <END> 2323L, 0.5, 1), row( -2323L, -1.5, 1)); }</code><technical_language>row(...) a single line</technical_language>

Target:
public void testHiveCoercionAvro() throws SQLException { HiveTableDefinition tableDefinition = HIVE_COERCION_AVRO; String tableName = mutableTableInstanceOf(tableDefinition).getNameInDatabase(); executeHiveQuery(format("INSERT INTO TABLE %s " + "PARTITION (id=1) " + "VALUES" + "(2323, 0.5)," + "(-2323, -1.5)", tableName)); executeHiveQuery(format("ALTER TABLE %s CHANGE COLUMN int_to_bigint int_to_bigint bigint", tableName)); executeHiveQuery(format("ALTER TABLE %s CHANGE COLUMN float_to_double float_to_double double", tableName)); assertThat(query("SHOW COLUMNS FROM " + tableName).project(1, 2)).containsExactly( row("int_to_bigint", "bigint"), row("float_to_double", "double"), row("id", "bigint")); QueryResult queryResult = query(format("SELECT * FROM " + tableName)); assertThat(queryResult).hasColumns(BIGINT, DOUBLE, BIGINT); assertThat(queryResult).containsOnly( row(2323L, 0.5, 1), row(-2323L, -1.5, 1)); }
Source:
<code>public void test_eviction_with_specific_eviction_prioritizer() throws Exception { <START> StandaloneCache<Number, String> cache = StandaloneCacheBuilder.newCacheBuilder(Number.class, String.class, LoggerFactory.getLogger(Ehcache.class + "StandaloneCacheEvictionTest")) <END> .withCapacity(1L) .prioritizeEviction(Eviction.Prioritizer.LRU) .build(); cache.init(); assertThat(cache.getRuntimeConfiguration().getCapacityConstraint(), equalTo((Comparable<Long>)1L)); for (int i = 0; i < 3; i++) { cache.putIfAbsent(i, "" + i); } int nullValuesFound = 0; for (int i = 0; i < 3; i++) { String retrievedValue = cache.get(i); if (retrievedValue == null) { nullValuesFound ++; } } assertThat("The capacity of the store is 1, and we found more than 1 non empty value in it !", nullValuesFound, is(2)); }</code><technical_language>Separator, for next change</technical_language>

Target:
public void test_eviction_with_specific_eviction_prioritizer() throws Exception { StandaloneCache<Number, String> cache = StandaloneCacheBuilder.newCacheBuilder(Number.class, String.class, LoggerFactory.getLogger(Ehcache.class + "-" + "StandaloneCacheEvictionTest")) .withCapacity(1L) .prioritizeEviction(Eviction.Prioritizer.LRU) .build(); cache.init(); assertThat(cache.getRuntimeConfiguration().getCapacityConstraint(), equalTo((Comparable<Long>)1L)); for (int i = 0; i < 3; i++) { cache.putIfAbsent(i, "" + i); } int nullValuesFound = 0; for (int i = 0; i < 3; i++) { String retrievedValue = cache.get(i); if (retrievedValue == null) { nullValuesFound ++; } } assertThat("The capacity of the store is 1, and we found more than 1 non empty value in it !", nullValuesFound, is(2)); }
Source:
<code>public OperationResult doOperationCallback() throws OperationException { final List<String> controlPluginNameList = paymentStateControlContext.getPaymentControlPluginNames(); <START> final String controlPluginNames = Joiner.on(", ").join(controlPluginNameList); <END> return dispatchWithAccountLockAndTimeout(controlPluginNames, new DispatcherCallback<PluginDispatcherReturnType<OperationResult>, OperationException>() { @Override public PluginDispatcherReturnType<OperationResult> doOperation() throws OperationException { final PaymentTransactionModelDao transaction = paymentStateContext.getPaymentTransactionModelDao(); final PaymentControlContext updatedPaymentControlContext = new DefaultPaymentControlContext(paymentStateContext.getAccount(), paymentStateContext.getPaymentMethodId(), paymentStateControlContext.getAttemptId(), transaction.getPaymentId(), paymentStateContext.getPaymentExternalKey(), transaction.getId(), paymentStateContext.getPaymentTransactionExternalKey(), PaymentApiType.PAYMENT_TRANSACTION, paymentStateContext.getTransactionType(), null, transaction.getAmount(), transaction.getCurrency(), transaction.getProcessedAmount(), transaction.getProcessedCurrency(), paymentStateControlContext.isApiPayment(), paymentStateContext.getCallContext()); executePluginOnSuccessCalls(paymentStateControlContext.getPaymentControlPluginNames(), updatedPaymentControlContext); return PluginDispatcher.createPluginDispatcherReturnType(OperationResult.SUCCESS); } }); }</code><technical_language>Joiner shared (private static final?)</technical_language>

Target:
public OperationResult doOperationCallback() throws OperationException { final List<String> controlPluginNameList = paymentStateControlContext.getPaymentControlPluginNames(); final String controlPluginNames = JOINER.join(controlPluginNameList); return dispatchWithAccountLockAndTimeout(controlPluginNames, new DispatcherCallback<PluginDispatcherReturnType<OperationResult>, OperationException>() { @Override public PluginDispatcherReturnType<OperationResult> doOperation() throws OperationException { final PaymentTransactionModelDao transaction = paymentStateContext.getPaymentTransactionModelDao(); final PaymentControlContext updatedPaymentControlContext = new DefaultPaymentControlContext(paymentStateContext.getAccount(), paymentStateContext.getPaymentMethodId(), paymentStateControlContext.getAttemptId(), transaction.getPaymentId(), paymentStateContext.getPaymentExternalKey(), transaction.getId(), paymentStateContext.getPaymentTransactionExternalKey(), PaymentApiType.PAYMENT_TRANSACTION, paymentStateContext.getTransactionType(), null, transaction.getAmount(), transaction.getCurrency(), transaction.getProcessedAmount(), transaction.getProcessedCurrency(), paymentStateControlContext.isApiPayment(), paymentStateContext.getCallContext()); executePluginOnSuccessCalls(paymentStateControlContext.getPaymentControlPluginNames(), updatedPaymentControlContext); return PluginDispatcher.createPluginDispatcherReturnType(OperationResult.SUCCESS); } }); }
Source:
<code>public void completeExceptionally(Predicate<SubscriptionQueryMessage<?, ?, ?>> filter, Throwable cause) { registeringSubscriptionQueryReadSafe(filter, () -> updateHandlers.keySet() .stream() .filter(filter) .forEach(query -> { <START> UpdateHandler<?, ?> updateHandler = updateHandlers.get(query); <END> updateHandlers.remove(query); updateHandler.onCompletedExceptionally(cause); })); }</code><technical_language>suggestion remove() function instantiate local updateHandler variable</technical_language>

Target:
public void completeExceptionally(Predicate<SubscriptionQueryMessage<?, ?, ?>> filter, Throwable cause) { updateHandlers.keySet() .stream() .filter(filter) .forEach(query -> Optional.ofNullable(updateHandlers.get(query)) .ifPresent(updateHandler -> emitError(query, cause, updateHandler))); }
Source:
<code>public boolean assign(final Map<UUID, ClientState> clientStates, final Set<TaskId> allTasks, final Set<TaskId> statefulTasks, final AssignmentConfigs configs) { this.configs = configs; this.clientStates = clientStates; this.allTasks = allTasks; this.statefulTasks = new TreeSet<>(statefulTasks); statelessTasks = new TreeSet<>(allTasks); statelessTasks.removeAll(statefulTasks); sortedClients = new TreeSet<>(); clientsToNumberOfThreads = new HashMap<>(); clientStates.forEach((client, state) -> { sortedClients.add(client); clientsToNumberOfThreads.put(client, state.capacity()); }); statefulTasksToRankedCandidates = buildClientRankingsByTask(statefulTasks, clientStates, configs.acceptableRecoveryLag); tasksToCaughtUpClients = tasksToCaughtUpClients(statefulTasksToRankedCandidates); if (shouldUsePreviousAssignment()) { assignPreviousTasksToClientStates(); return false; } final Map<TaskId, Integer> tasksToRemainingStandbys = statefulTasks.stream().collect(Collectors.toMap(task -> task, t -> configs.numStandbyReplicas)); final boolean followupRebalanceNeeded = assignStatefulActiveTasks(tasksToRemainingStandbys); assignStandbyReplicaTasks(tasksToRemainingStandbys); assignStatelessActiveTasks(); <START> log.info("Decided on assignment: " + <END> clientStates + " with " + (followupRebalanceNeeded ? "" : "no") + " followup rebalance."); return followupRebalanceNeeded; }</code><technical_language>for useful logging</technical_language>

Target:
public boolean assign(final Map<UUID, ClientState> clientStates, final Set<TaskId> allTasks, final Set<TaskId> statefulTasks, final AssignmentConfigs configs) { this.configs = configs; this.clientStates = clientStates; this.allTasks = allTasks; this.statefulTasks = new TreeSet<>(statefulTasks); statelessTasks = new TreeSet<>(allTasks); statelessTasks.removeAll(statefulTasks); sortedClients = new TreeSet<>(); clientsToNumberOfThreads = new HashMap<>(); clientStates.forEach((client, state) -> { sortedClients.add(client); clientsToNumberOfThreads.put(client, state.capacity()); }); statefulTasksToRankedCandidates = buildClientRankingsByTask(statefulTasks, clientStates, configs.acceptableRecoveryLag); tasksToCaughtUpClients = tasksToCaughtUpClients(statefulTasksToRankedCandidates); if (shouldUsePreviousAssignment()) { assignPreviousTasksToClientStates(); return false; } final Map<TaskId, Integer> tasksToRemainingStandbys = statefulTasks.stream().collect(Collectors.toMap(task -> task, t -> configs.numStandbyReplicas)); final boolean probingRebalanceNeeded = assignStatefulActiveTasks(tasksToRemainingStandbys); assignStandbyReplicaTasks(tasksToRemainingStandbys); assignStatelessActiveTasks(); log.info("Decided on assignment: " + clientStates + " with " + (probingRebalanceNeeded ? "" : "no") + " followup probing rebalance."); return probingRebalanceNeeded; }
Source:
<code><START> public void testBuilderWithDefaultValues() { <END> StudentAttributes sd = StudentAttributes .builder("courseId", "Joe White", "e@e.com") .build(); ______TS("success : defaultTimeStamp for createdAt date"); assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getCreatedAt()); ______TS("success : defaultTimeStamp for updatedAt date"); assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getUpdatedAt()); ______TS("success : default value for googleId"); assertEquals("", sd.googleId); ______TS("success : default value for section"); assertEquals(Const.DEFAULT_SECTION, sd.section); ______TS("success : default value for updateStatus"); assertEquals(StudentUpdateStatus.UNKNOWN, sd.updateStatus); ______TS("success : default value for lastName"); assertEquals("White", sd.lastName); }</code><technical_language>this is removed, if fields createdAt updatedAt private instead</technical_language>

Target:
public void testBuilderWithDefaultValues() { StudentAttributes sd = StudentAttributes .builder("courseId", "Joe White", "e@e.com") .build(); assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getCreatedAt()); assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getUpdatedAt()); assertEquals("", sd.googleId); assertEquals(Const.DEFAULT_SECTION, sd.section); assertEquals(StudentUpdateStatus.UNKNOWN, sd.updateStatus); assertEquals("White", sd.lastName); }
Source:
<code>private void onSuccess(String result) { if (mListener != null) { <START> mListener.onSuccess(result); <END> } else { Log.v(TAG, "Cancelled callback and outstanding requests"); } }</code><technical_language>is lock here, check mListener, get set null access onSuccess. a race</technical_language>

Target:
private void onSuccess(String result) { synchronized(mListenerLock) { if (mListener != null) { mListener.onSuccess(result); } else { Log.v(TAG, "Cancelled callback and outstanding requests"); } } }
Source:
<code>private boolean callActionServiceMethod(ActionEvent action, Integer actionIndex, Map<String, Object> parameters, TaskContext taskContext) throws TaskHandlerException { ServiceReference reference = bundleContext.getServiceReference( action.getServiceInterface() ); boolean serviceAvailable = reference != null; if (serviceAvailable) { Object service = bundleContext.getService(reference); String serviceMethod = action.getServiceMethod(); MethodHandler methodHandler = new MethodHandler(action, parameters); try { Method method = service.getClass().getMethod(serviceMethod, methodHandler.getClasses()); try { Object object = method.invoke(service, methodHandler.getObjects()); <START> addPostActionParametersToTaskContext(action, actionIndex, taskContext, object); <END> } catch (IllegalAccessException | InvocationTargetException e) { throw new TaskHandlerException( ACTION, "task.error.serviceMethodInvokeError", e, serviceMethod, action.getServiceInterface() ); } } catch (NoSuchMethodException e) { throw new TaskHandlerException( ACTION, "task.error.notFoundMethodForService", e, serviceMethod, action.getServiceInterface() ); } } return serviceAvailable; }</code><technical_language>if object null</technical_language>

Target:
private boolean callActionServiceMethod(ActionEvent action, Integer actionIndex, Map<String, Object> parameters, TaskContext taskContext) throws TaskHandlerException { ServiceReference reference = bundleContext.getServiceReference( action.getServiceInterface() ); boolean serviceAvailable = reference != null; if (serviceAvailable) { Object service = bundleContext.getService(reference); String serviceMethod = action.getServiceMethod(); MethodHandler methodHandler = new MethodHandler(action, parameters); try { Method method = service.getClass().getMethod(serviceMethod, methodHandler.getClasses()); try { Object object = method.invoke(service, methodHandler.getObjects()); if (object != null) { addPostActionParametersToTaskContext(action, actionIndex, taskContext, object); } } catch (IllegalAccessException | InvocationTargetException e) { throw new TaskHandlerException( ACTION, "task.error.serviceMethodInvokeError", e, serviceMethod, action.getServiceInterface() ); } } catch (NoSuchMethodException e) { throw new TaskHandlerException( ACTION, "task.error.notFoundMethodForService", e, serviceMethod, action.getServiceInterface() ); } } return serviceAvailable; }
Source:
<code>public UsersWorkspaceDto startById(@PathParam("id") String workspaceId, @QueryParam("environment") String envName, @QueryParam("accountId") String accountId) throws ServerException, BadRequestException, NotFoundException, ForbiddenException { ensureUserIsWorkspaceOwner(workspaceId); final Map<String, String> params = ImmutableMap.of("accountId", accountId, "workspaceId", workspaceId); <START> permissionManager.checkPermission(START_WORKSPACE, getCurrentUserId(), params); <END> return injectLinks(DtoConverter.asDto(workspaceManager.startWorkspaceById(workspaceId, envName, accountId))); }</code><technical_language>line</technical_language>

Target:
public UsersWorkspaceDto startById(@PathParam("id") String workspaceId, @QueryParam("environment") String envName, @QueryParam("accountId") String accountId) throws ServerException, BadRequestException, NotFoundException, ForbiddenException { ensureUserIsWorkspaceOwner(workspaceId); permissionManager.checkPermission(START_WORKSPACE, getCurrentUserId(), ImmutableMap.of("accountId", accountId, "workspaceId", workspaceId)); return injectLinks(DtoConverter.asDto(workspaceManager.startWorkspaceById(workspaceId, envName, accountId))); }
Source:
<code>public @NotNull Span popSpan() throws EmptyStackException { if (!hasSpan()) { throw new EmptyStackException(); } else { <START> try (Scope scope = scopeManager.active()) { <END> return scope.span(); } } }</code><technical_language>again, unnecessary double-retrieval. scope = mgr.active(); if (scope == null) throw EmptyStackException; span = scope.span(); scope.close(); return span;</technical_language>

Target:
public @NotNull Span popSpan() throws EmptyStackException { try (Scope scope = scopeManager.active()) { if (scope == null) { throw new EmptyStackException(); } return scope.span(); } }
Source:
<code>public EapResult process(EapMessage message) { if (message.eapCode == EAP_CODE_SUCCESS) { <START> transitionTo(new FinalState()); <END> return new EapSuccess(MSK, EMSK); } else if (message.eapCode == EAP_CODE_FAILURE) { transitionTo(new FinalState()); return new EapFailure(); } else if (message.eapData.eapType == EAP_NOTIFICATION) { return handleEapNotification(mTAG, message); } if (message.eapData.eapType != getEapMethod()) { return new EapError(new EapInvalidRequestException( "Expected EAP Type " + getEapMethod() + ", received " + message.eapData.eapType)); } DecodeResult<EapAkaTypeData> decodeResult = mEapAkaTypeDataDecoder.decode(message.eapData.eapTypeData); if (!decodeResult.isSuccessfulDecode()) { return buildClientErrorResponse( message.eapIdentifier, EAP_TYPE_AKA, decodeResult.atClientErrorCode); } EapAkaTypeData eapAkaTypeData = decodeResult.eapTypeData; switch (eapAkaTypeData.eapSubtype) { case EAP_AKA_CHALLENGE: break; case EAP_AKA_NOTIFICATION: throw new UnsupportedOperationException( "EAP-AKA notifications not supported yet"); default: return buildClientErrorResponse( message.eapIdentifier, EAP_TYPE_AKA, AtClientErrorCode.UNABLE_TO_PROCESS); } if (!isValidChallengeAttributes(eapAkaTypeData)) { return buildClientErrorResponse( message.eapIdentifier, EAP_TYPE_AKA, AtClientErrorCode.UNABLE_TO_PROCESS); } return null; }</code><technical_language>need check authenticated safely. if get a invalid sequence number need resync, a success after, transition straight final</technical_language>

Target:
public EapResult process(EapMessage message) { if (message.eapCode == EAP_CODE_SUCCESS) { if (!mCanReceiveSuccess) { LOG.e(mTAG, "Received unexpected EAP-Success"); return new EapError( new EapInvalidRequestException( "Received an EAP-Success in the ChallengeState")); } transitionTo(new FinalState()); return new EapSuccess(mMSK, mEMSK); } else if (message.eapCode == EAP_CODE_FAILURE) { transitionTo(new FinalState()); return new EapFailure(); } else if (message.eapData.eapType == EAP_NOTIFICATION) { return handleEapNotification(mTAG, message); } if (message.eapData.eapType != getEapMethod()) { return new EapError(new EapInvalidRequestException( "Expected EAP Type " + getEapMethod() + ", received " + message.eapData.eapType)); } DecodeResult<EapAkaTypeData> decodeResult = mEapAkaTypeDataDecoder.decode(message.eapData.eapTypeData); if (!decodeResult.isSuccessfulDecode()) { return buildClientErrorResponse( message.eapIdentifier, EAP_TYPE_AKA, decodeResult.atClientErrorCode); } EapAkaTypeData eapAkaTypeData = decodeResult.eapTypeData; switch (eapAkaTypeData.eapSubtype) { case EAP_AKA_CHALLENGE: break; case EAP_AKA_NOTIFICATION: throw new UnsupportedOperationException( "EAP-AKA notifications not supported yet"); default: return buildClientErrorResponse( message.eapIdentifier, EAP_TYPE_AKA, AtClientErrorCode.UNABLE_TO_PROCESS); } if (!isValidChallengeAttributes(eapAkaTypeData)) { return buildClientErrorResponse( message.eapIdentifier, EAP_TYPE_AKA, AtClientErrorCode.UNABLE_TO_PROCESS); } return null; }
Source:
<code>public static void setupJoysticks() { DriveCode.leftJoystickChannel = Igneous.joystick1.getYAxisSource(); DriveCode.rightJoystickChannel = Igneous.joystick1.getAxisSource(6); DriveCode.octocanumShifting = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(1), Igneous.globalPeriodic); Elevator.raisingInput = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(2), Igneous.globalPeriodic); <START> Elevator.loweringInput = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(3), Igneous.globalPeriodic); <END> }</code><technical_language>send events instead of booleans for buttons. This code simpler - do Igneous.joystick1.getButtonSource(button) give EventInput for button</technical_language>

Target:
public static void setupJoysticks() { DriveCode.leftJoystickChannel = Igneous.joystick1.getYAxisSource(); DriveCode.rightJoystickChannel = Igneous.joystick1.getAxisSource(6); DriveCode.octocanumShifting = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(1), Igneous.globalPeriodic); Elevator.raisingInput = Igneous.joystick1.getButtonSource(2); Elevator.loweringInput = Igneous.joystick1.getButtonSource(3); Rollers.runRollersButton = Igneous.joystick2.getButtonSource(3); Rollers.toggleRollersButton =Igneous.joystick2.getButtonSource(4); }
Source:
<code>public void close() throws IOException { <START> if (!closed && inputStream != null) { <END> try { ByteStreams.exhaust(this); inputStream.close(); } finally { this.closed = true; } } }</code><technical_language>I inputStream null here</technical_language>

Target:
public void close() throws IOException { if (!closed && in != null) { try { ByteStreams.exhaust(this); super.in.close(); } finally { this.closed = true; } } }
Source:
<code>private void bind() { $(shoppingBagWidget).hide(); shoppingBagOpen = false; $(backTop).click(new Function() { @Override public void f() { $("html, body").each(new Function() { @Override public void f(Element element) { new ScrollTopAnimation(element).run(ANIMATION_DURATION); } }); } }); $(cartButton).click(new Function() { @Override public void f() { if (shoppingBagOpen) { $(shoppingBagWidget).show(); <START> $(cartIcon).attr("class", "iconClose"); <END> shoppingBagOpen = false; } else { $(shoppingBagWidget).hide(); $(cartIcon).attr("class", "iconCart"); shoppingBagOpen = true; } } }); setI18nAnchors(); }</code><technical_language>iconXXX style in a Resource file? If reference instead</technical_language>

Target:
private void bind() { $(shoppingBagWidget).hide(); shoppingBagOpen = false; $(backTop).click(new Function() { @Override public void f() { $("html, body").each(new Function() { @Override public void f(Element element) { new ScrollTopAnimation(element).run(ANIMATION_DURATION); } }); } }); $(cartButton).click(new Function() { @Override public void f() { if (shoppingBagOpen) { $(shoppingBagWidget).show(); $(cartIcon).attr("class", fontRes.icons().iconClose()); shoppingBagOpen = false; } else { $(shoppingBagWidget).hide(); $(cartIcon).attr("class", fontRes.icons().iconCart()); shoppingBagOpen = true; } } }); setI18nAnchors(); }
Source:
<code>public static org.kie.dmn.model.api.InputClause dmnFromWB(final InputClause wb) { org.kie.dmn.model.api.InputClause result = new org.kie.dmn.model.v1_2.TInputClause(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); org.kie.dmn.model.api.LiteralExpression expression = LiteralExpressionPropertyConverter.dmnFromWB(wb.getInputExpression()); UnaryTests inputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getInputValues()); if (expression != null) { expression.setParent(result); } result.setInputExpression(expression); <START> if (inputValues != null && !inputValues.getText().isEmpty()) { <END> inputValues.setParent(result); result.setInputValues(inputValues); } return result; }</code><technical_language>org.kie.workbench.common.stunner.core.util.StringUtils.nonEmpty(..) (but know!?!)</technical_language>

Target:
public static org.kie.dmn.model.api.InputClause dmnFromWB(final InputClause wb) { org.kie.dmn.model.api.InputClause result = new org.kie.dmn.model.v1_2.TInputClause(); result.setId(wb.getId().getValue()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); org.kie.dmn.model.api.LiteralExpression expression = LiteralExpressionPropertyConverter.dmnFromWB(wb.getInputExpression()); UnaryTests inputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getInputValues()); if (expression != null) { expression.setParent(result); } result.setInputExpression(expression); if (inputValues != null && StringUtils.nonEmpty(inputValues.getText())) { inputValues.setParent(result); result.setInputValues(inputValues); } return result; }
Source:
<code>public void onDisplay(NavigateEvent navigateEvent) { super.onDisplay(navigateEvent); if (!tabPane.getTabs().isEmpty()) { Tab tab = tabPane.getSelectionModel().getSelectedItem(); <START> Optional.ofNullable(nameToChatTabController.get(tab.getId())).ifPresent(AbstractChatTabController::onDisplay); <END> } }</code><technical_language>real question is: a tab in UI entry in nameToChatTabController? possible, concealing a bug. Hint: synchronize access tabPane.getTabs() nameToChatTabController nameToChatTabController</technical_language>

Target:
public void onDisplay(NavigateEvent navigateEvent) { super.onDisplay(navigateEvent); Platform.runLater(() -> { if (!tabPane.getTabs().isEmpty()) { Tab tab = tabPane.getSelectionModel().getSelectedItem(); if (tab != null) { nameToChatTabController.get(tab.getId()).onDisplay(); } } }); }
Source:
<code><START> public static String buildCommandLine(String workspace) throws NullPointerException { <END> String property = System.getProperty(PROP_VM); Assert.isNotNull(property, "'" + PROP_VM + "' system property is not set!"); StringBuilder result = new StringBuilder(512); result.append(property); result.append('\n'); String vmargs = System.getProperty(PROP_VMARGS); if (vmargs != null) { result.append(vmargs); } property = System.getProperty(PROP_COMMANDS); if (property == null) { result.append(CMD_DATA); result.append('\n'); result.append(workspace); result.append('\n'); } else { int cmd_data_pos = property.lastIndexOf(CMD_DATA); if (cmd_data_pos != -1) { cmd_data_pos += CMD_DATA.length() + 1; result.append(property.substring(0, cmd_data_pos)); result.append(workspace); int nextArg = property.indexOf("\n-", cmd_data_pos - 1); if (nextArg != -1) { result.append(property.substring(nextArg)); } } else { result.append(CMD_DATA); result.append('\n'); result.append(workspace); result.append('\n'); result.append(property); } } if (vmargs != null) { if (result.charAt(result.length() - 1) != '\n') { result.append('\n'); } result.append(CMD_VMARGS); result.append('\n'); result.append(vmargs); } return result.toString(); }</code><technical_language>is this public of a sudden? I find code calling this of class, in platform UI repo? some previous version of change needed static? OpenWorkspaceAction longer calls this, calls new method sets restart arguments</technical_language>

Target:
private static String buildCommandLine(String workspace) { String property = System.getProperty(PROP_VM); if (property == null) { if (!Platform.inDevelopmentMode()) { WorkbenchPlugin.log(NLS.bind(WorkbenchMessages.Workbench_missingPropertyMessage, PROP_VM)); } return null; } StringBuilder result = new StringBuilder(512); result.append(property); result.append('\n'); String vmargs = System.getProperty(PROP_VMARGS); if (vmargs != null) { result.append(vmargs); } property = System.getProperty(PROP_COMMANDS); if (property == null) { result.append(CMD_DATA); result.append('\n'); result.append(workspace); result.append('\n'); } else { int cmd_data_pos = property.lastIndexOf(CMD_DATA); if (cmd_data_pos != -1) { cmd_data_pos += CMD_DATA.length() + 1; result.append(property.substring(0, cmd_data_pos)); result.append(workspace); int nextArg = property.indexOf("\n-", cmd_data_pos - 1); if (nextArg != -1) { result.append(property.substring(nextArg)); } } else { result.append(CMD_DATA); result.append('\n'); result.append(workspace); result.append('\n'); result.append(property); } } if (vmargs != null) { if (result.charAt(result.length() - 1) != '\n') { result.append('\n'); } result.append(CMD_VMARGS); result.append('\n'); result.append(vmargs); } return result.toString(); }
Source:
<code>public ImmutablePair<String, ImmutableSet<String>> parse(String experimentAccession) { try (TsvStreamer aeTitleIdfStreamer = idfReaderFactory.create(experimentAccession); TsvStreamer titleIdfStreamer = idfReaderFactory.create(experimentAccession); TsvStreamer pubmedIdfStreamer = idfReaderFactory.create(experimentAccession)) { String title = ""; title = aeTitleIdfStreamer.get() .filter(line -> line.length > 1) .filter(line -> AE_EXPERIMENT_DISPLAY_NAME.equalsIgnoreCase(line[0].trim())) .map(line-> line[1]) .findFirst() .orElse(""); if(title.isEmpty()) { title = titleIdfStreamer.get() .filter(line -> line.length > 1) .filter(line -> INVESTIGATION_TITLE_ID.equalsIgnoreCase(line[0].trim())) .map(line -> line[1]) .findFirst() .orElse(""); } <START> <END> ImmutableSet<String> pubmedIds = ImmutableSet.copyOf( pubmedIdfStreamer.get() .filter(line -> line.length > 1) .filter(line -> PUBMED_ID.equalsIgnoreCase(line[0].trim())) .flatMap(line -> Arrays.stream(line).skip(1)) .iterator()); return ImmutablePair.of(title, pubmedIds); } }</code><technical_language>need set initial value, .orElse("") care of that. Also, I simplify logic filtering lines match AE_EXPERIMENT_DISPLAY_NAME INVESTIGATION_TITLE_ID, need stream twice</technical_language>

Target:
public ImmutablePair<String, ImmutableSet<String>> parse(String experimentAccession) { try ( TsvStreamer titleIdfStreamer = idfReaderFactory.create(experimentAccession); TsvStreamer pubmedIdfStreamer = idfReaderFactory.create(experimentAccession)) { Map<String, String> titles = titleIdfStreamer.get() .filter(line -> line.length > 1) .filter(line -> AE_EXPERIMENT_DISPLAY_NAME.equalsIgnoreCase(line[0].trim()) || INVESTIGATION_TITLE_ID.equalsIgnoreCase(line[0].trim())) .collect(Collectors.toMap(line -> line[0].toUpperCase().trim(), line-> line[1])); String title = titles.getOrDefault(AE_EXPERIMENT_DISPLAY_NAME.toUpperCase(), titles.getOrDefault(INVESTIGATION_TITLE_ID.toUpperCase(), "")); ImmutableSet<String> pubmedIds = ImmutableSet.copyOf( pubmedIdfStreamer.get() .filter(line -> line.length > 1) .filter(line -> PUBMED_ID.equalsIgnoreCase(line[0].trim())) .flatMap(line -> Arrays.stream(line).skip(1)) .iterator()); return ImmutablePair.of(title, pubmedIds); } }