auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void doWork(IProgressMonitor monitor) throws OseeCoreException { if (teamDefs.isEmpty() && ais.isEmpty()) { throw new OseeArgumentException("ERROR", "Must provide Team Definitions or Actionable Items"); } List<String> guids = new ArrayList<String>(); addAllTeamDefGuids(teamDefs, includeChildrenTeamDefs, guids); addAllAisGuids(ais, includeChildrenAis, guids); for (Artifact teamOrAiArt : ArtifactQuery.getArtifactListFromIds(guids, AtsUtilCore.getAtsBranch())) { for (Artifact workPkgArt : teamOrAiArt.getRelatedArtifacts(AtsRelationTypes.WorkPackage_WorkPackage)) { boolean active = workPkgArt.getSoleAttributeValue(AtsAttributeTypes.Active, true); if (activeWorkPkgs == Active.Both || ((active && activeWorkPkgs == Active.Active) || (!active && activeWorkPkgs == Active.InActive))) { results.add(workPkgArt); } } } }

Target:
protected void doWork(IProgressMonitor monitor) throws OseeCoreException { if (teamDefs.isEmpty() && ais.isEmpty()) { throw new OseeArgumentException("ERROR", "Must provide Team Definitions or Actionable Items"); } checkForCancelledStatus(monitor); List<String> guids = new ArrayList<String>(); addAllTeamDefGuids(monitor, teamDefs, includeChildrenTeamDefs, guids); addAllAisGuids(monitor, ais, includeChildrenAis, guids); for (Artifact teamOrAiArt : ArtifactQuery.getArtifactListFromIds(guids, AtsUtilCore.getAtsBranch())) { for (Artifact workPkgArt : teamOrAiArt.getRelatedArtifacts(AtsRelationTypes.WorkPackage_WorkPackage)) { boolean active = workPkgArt.getSoleAttributeValue(AtsAttributeTypes.Active, true); if (activeWorkPkgs == Active.Both || ((active && activeWorkPkgs == Active.Active) || (!active && activeWorkPkgs == Active.InActive))) { results.add(workPkgArt); } checkForCancelledStatus(monitor); } checkForCancelledStatus(monitor); } }
Source:
public String toString() { return ToStringBuilder.forInstance(this) .append("Private SPM Id", privateSpmId) .append("Private SPM Version", privateSpmLVER) .append("SPM Status", privateSpmStatus) .build(); }

Target:
public String toString() { return ToStringBuilder.forInstance(this) .append("SPM Id", spmId) .append("SPM LVER", spmLVER) .append("SPM Status", spmStatus) .build(); }
Source:
public static WasbUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf) { Configuration wasbConf = createConfiguration(conf, uri.getScheme().startsWith("wasb://")); return new WasbUnderFileSystem(uri, conf, wasbConf); }

Target:
public static WasbUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf) { Configuration wasbConf = createConfiguration(conf, uri.getScheme().startsWith(SCHEME_SECURE)); return new WasbUnderFileSystem(uri, conf, wasbConf); }
Source:
public List<Project> getAllProjects(User user) { List<Project> projects = new ArrayList<Project>(); projects.addAll(projectDao.getAll(user)); List<String> projectIds = projectAdminDao.findProjectIdsByAdmin(user.getUserId()); for (String projectId : projectIds) { try { Project project = getProject(projectId); projects.add(project); } catch (CloudFlowNotFoundException cfe) { } } return projects; }

Target:
public List<Project> getAllProjects(User user) { List<Project> projects = new ArrayList<Project>(); projects.addAll(projectDao.getAll(user)); List<String> projectIds = projectAdminDao.findProjectIdsByAdmin(user.getUserId()); for (String projectId : projectIds) { try { Project project = getProject(projectId); if (!projects.contains(project)) { projects.add(project); } } catch (CloudFlowNotFoundException cfe) { } } return projects; }
Source:
public String toString() { return "JoinOperatorInfo{" + "joinType=" + joinType + ", logHistogramProbes=" + Arrays.toString(logHistogramProbes) + ", logHistogramOutput=" + Arrays.toString(logHistogramOutput) + '}'; }

Target:
public String toString() { return toStringHelper(this) .add("joinType", joinType) .add("logHistogramProbes", logHistogramProbes) .add("logHistogramOutput", logHistogramOutput) .toString(); }
Source:
@Test public void testSingleParam() { DeepLinkEntry entry = deepLinkEntry("airbnb://foo/{bar}"); final Optional<DeepLinkMatch> matches = entry.matches("airbnb://foo/myData"); assertThat(matches.isPresent()).isTrue(); assertThat(matches.get().getEntry()).isEqualTo(entry); final Map<String, String> parameters = matches.get().getParameters(); assertThat(parameters.get("bar")).isEqualTo("myData"); }

Target:
@Test public void testSingleParam() { DeepLinkEntry entry = deepLinkEntry("airbnb://foo/{bar}"); Optional<DeepLinkMatch> matches = entry.matches("airbnb://foo/myData"); assertThat(matches.isPresent()).isTrue(); assertThat(matches.get().getEntry()).isEqualTo(entry); Map<String, String> parameters = matches.get().getParameters(); assertThat(parameters.get("bar")).isEqualTo("myData"); }
Source:
public void run() { CoreSession session = ctx.getCoreSession(); Object input = ctx.getInput(); RetentionEventContext evctx = new RetentionEventContext(session.getPrincipal()); if (input != null) { if (input instanceof String) { evctx.setInput((String) input); } } Event event = evctx.newEvent(name); service.fireEvent(event); if (audit) { AuditLogger logger = Framework.getService(AuditLogger.class); LogEntry entry = logger.newLogEntry(); entry.setEventId(name); entry.setEventDate(new Date()); entry.setCategory(RetentionConstants.EVENT_CATEGORY); entry.setPrincipalName(session.getPrincipal().getName()); entry.setComment(evctx.getInput()); logger.addLogEntries(Collections.singletonList(entry)); } }

Target:
public void run() { CoreSession session = ctx.getCoreSession(); Object input = ctx.getInput(); RetentionEventContext evctx = new RetentionEventContext(session.getPrincipal()); if (input instanceof String) { evctx.setInput((String) input); } Event event = evctx.newEvent(name); service.fireEvent(event); if (audit) { AuditLogger logger = Framework.getService(AuditLogger.class); LogEntry entry = logger.newLogEntry(); entry.setEventId(name); entry.setEventDate(new Date()); entry.setCategory(RetentionConstants.EVENT_CATEGORY); entry.setPrincipalName(session.getPrincipal().getName()); entry.setComment(evctx.getInput()); logger.addLogEntries(Collections.singletonList(entry)); } }
Source:
public Future<R> queue() { final Observable<R> o = toObservable(); final Future<R> f = new Future<R>() { final Future<R> base = o.toBlocking().toFuture(); @Override public boolean cancel(boolean mayInterruptIfRunning) { if (base.isCancelled()) { return false; } mayInterruptOnCancel.set(mayInterruptIfRunning); return base.cancel(mayInterruptIfRunning); } @Override public boolean isCancelled() { return base.isCancelled(); } @Override public boolean isDone() { return base.isDone(); } @Override public R get() throws InterruptedException, ExecutionException { return base.get(); } @Override public R get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return base.get(timeout, unit); } }; if (f.isDone()) { try { f.get(); return f; } catch (Exception e) { RuntimeException re = decomposeException(e); if (re instanceof HystrixBadRequestException) { return f; } else if (re instanceof HystrixRuntimeException) { HystrixRuntimeException hre = (HystrixRuntimeException) re; if (hre.getFailureType() == FailureType.COMMAND_EXCEPTION || hre.getFailureType() == FailureType.TIMEOUT) { return f; } else { throw hre; } } else { throw re; } } } return f; }

Target:
public Future<R> queue() { final Future<R> delegate = toObservable().toBlocking().toFuture(); final Future<R> f = new Future<R>() { @Override public boolean cancel(boolean mayInterruptIfRunning) { if (delegate.isCancelled()) { return false; } if (HystrixCommand.this.getProperties().executionIsolationThreadInterruptOnFutureCancel().get()) { interruptOnFutureCancel.compareAndSet(false, mayInterruptIfRunning); } final boolean res = delegate.cancel(interruptOnFutureCancel.get()); if (!isExecutionComplete() && interruptOnFutureCancel.get()) { final Thread t = executionThread.get(); if (t != null && !t.equals(Thread.currentThread())) { t.interrupt(); } } return res; } @Override public boolean isCancelled() { return delegate.isCancelled(); } @Override public boolean isDone() { return delegate.isDone(); } @Override public R get() throws InterruptedException, ExecutionException { return delegate.get(); } @Override public R get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return delegate.get(timeout, unit); } }; if (f.isDone()) { try { f.get(); return f; } catch (Exception e) { RuntimeException re = decomposeException(e); if (re instanceof HystrixBadRequestException) { return f; } else if (re instanceof HystrixRuntimeException) { HystrixRuntimeException hre = (HystrixRuntimeException) re; switch (hre.getFailureType()) { case COMMAND_EXCEPTION: case TIMEOUT: return f; default: throw hre; } } else { throw re; } } } return f; }
Source:
public MeterResponseData dequeue(final String correlationUid) throws FunctionalException { try { final MeterResponseData meterResponseData = this.meterResponseDataRepository .findSingleResultByCorrelationUid(correlationUid); if (meterResponseData == null) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_CORRELATION_UID, ComponentType.WS_SMART_METERING); } this.remove(meterResponseData); return meterResponseData; } catch (final FunctionalException e) { if (e.getExceptionType() == FunctionalExceptionType.UNKNOWN_CORRELATION_UID) { LOGGER.warn("No response data for correlation UID {}", correlationUid); } throw e; } }

Target:
public MeterResponseData dequeue(final String correlationUid) throws FunctionalException { final MeterResponseData meterResponseData = this.meterResponseDataRepository .findSingleResultByCorrelationUid(correlationUid); if (meterResponseData == null) { LOGGER.warn("No response data for correlation UID {}", correlationUid); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_CORRELATION_UID, ComponentType.WS_SMART_METERING); } this.remove(meterResponseData); return meterResponseData; }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { BigDecimal result = null; for (int i=0; i<children.size(); i++) { Expression childExpr = children.get(i); if (!childExpr.evaluate(tuple, ptr) || ptr.getLength() == 0) { return false; } PDataType childType = children.get(i).getDataType(); BigDecimal bd= (BigDecimal)PDataType.DECIMAL.toObject(ptr, childType); if (result == null) { result = bd; maxLength = childExpr.getMaxLength(); scale = childExpr.getScale(); } else { result = result.add(bd); if (maxLength != null && scale != null && childExpr.getMaxLength() != null & childExpr.getScale() != null) { int desiredPrecision = NumberUtil.getDecimalPrecision(NumericOperators.ADD, maxLength, childExpr.getMaxLength(), scale, childExpr.getScale()); int desiredScale = NumberUtil.getDecimalScale(NumericOperators.ADD, maxLength, childExpr.getMaxLength(), scale, childExpr.getScale()); result = NumberUtil.setDecimalWidthAndScale(result, desiredPrecision, desiredScale); if (result == null) { return false; } maxLength = desiredPrecision; scale = desiredScale; } } } ptr.set(PDataType.DECIMAL.toBytes(result)); return true; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { BigDecimal result = null; for (int i=0; i<children.size(); i++) { Expression childExpr = children.get(i); if (!childExpr.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } PDataType childType = children.get(i).getDataType(); BigDecimal bd= (BigDecimal)PDataType.DECIMAL.toObject(ptr, childType); if (result == null) { result = bd; } else { result = result.add(bd); } } if (maxLength != null && scale != null) { result = NumberUtil.setDecimalWidthAndScale(result, maxLength, scale); } if (result == null) { return false; } ptr.set(PDataType.DECIMAL.toBytes(result)); return true; }
Source:
private static <T extends HasMetadata> Function<T, Boolean> waitUntilDeletedOrInterrupted(OkHttpClient client, Config config, ResourceHandler<HasMetadata, HasMetadataVisitiableBuilder> h, String namespaceToUse) { return m -> { try { return h.waitUntilCondition(client, config, namespaceToUse, m, Objects::isNull, 30 , TimeUnit.SECONDS) == null; } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.warn("interrupted waiting for item to be deleted, assuming not deleted"); return false; } }; }

Target:
private static <T extends HasMetadata> Function<T, Boolean> waitUntilDeletedOrInterrupted(OkHttpClient client, Config config, ResourceHandler<HasMetadata, HasMetadataVisitiableBuilder> h, String namespaceToUse) { return m -> { try { return h.waitUntilCondition(client, config, namespaceToUse, m, Objects::isNull, MAX_WAIT_SECONDS , TimeUnit.SECONDS) == null; } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.warn("interrupted waiting for item to be deleted, assuming not deleted"); return false; } }; }
Source:
private void delayFor3dsReady(ChargeEntity charge) { int totalTimeDelayedInMillis = 0; int delayInMillis = 200; while (totalTimeDelayedInMillis < stripeGatewayConfig.getNotification3dsWaitDelay()) { ChargeEntity chargeEntity = chargeService.findChargeById(charge.getExternalId()); if (ChargeStatus.fromString(chargeEntity.getStatus()) == AUTHORISATION_3DS_READY) { break; } logger.info("Frontend has not posted 3ds ready locking state for charge [{}]," + " waiting for 200ms", charge.getExternalId()); try { Thread.sleep(delayInMillis); } catch (InterruptedException e) { logger.error("Waiting for 3ds ready locking state failed, {}", kv("error", e.getMessage())); } totalTimeDelayedInMillis += delayInMillis; } }

Target:
private void delayFor3dsReady(ChargeEntity charge) { int totalTimeDelayedInMillis = 0; int delayInMillis = 200; while (totalTimeDelayedInMillis < stripeGatewayConfig.getNotification3dsWaitDelay()) { ChargeEntity chargeEntity = chargeService.findChargeById(charge.getExternalId()); if (ChargeStatus.fromString(chargeEntity.getStatus()) == AUTHORISATION_3DS_READY) { break; } try { Thread.sleep(delayInMillis); } catch (InterruptedException e) { logger.error("Waiting for 3ds ready locking state failed, {}", kv("error", e.getMessage())); } totalTimeDelayedInMillis += delayInMillis; } logger.info("Total time waited for Frontend to update charge to 3ds ready - milliseconds," , kv(PAYMENT_EXTERNAL_ID, charge.getExternalId()), totalTimeDelayedInMillis); }
Source:
public Set<Id> getEffectiveGroups() { if (effectiveGroups == null) { effectiveGroups = new HashSet<Id>(); if (authGroupNames == null) { effectiveGroups.addAll(authConfig.getAnonymousGroups()); } else { effectiveGroups.addAll(authConfig.getRegisteredGroups()); for (String authGroupName : authGroupNames) { AccountGroup group = groupCache.lookup(authGroupName); if (group != null) { effectiveGroups.add(group.getId()); } } } } return effectiveGroups; }

Target:
public Set<AccountGroup.Id> getEffectiveGroups() { return Collections.unmodifiableSet(effectiveGroups); }
Source:
private void finishInput() { if (lookupSourceFactoryDestroyed.isDone()) { close(); return; } LookupSourceSupplier partition = buildLookupSource(); if (spillEnabled) { operatorContext.setRevocableMemoryReservation(partition.get().getInMemorySizeInBytes()); } else { operatorContext.setMemoryReservation(partition.get().getInMemorySizeInBytes()); } lookupSourceNotNeeded = Optional.of(lookupSourceFactory.lendPartitionLookupSource(partitionIndex, partition)); state = State.LOOKUP_SOURCE_BUILT; }

Target:
private void finishInput() { checkState(state == State.CONSUMING_INPUT); if (lookupSourceFactoryDestroyed.isDone()) { close(); return; } LookupSourceSupplier partition = buildLookupSource(); if (spillEnabled) { operatorContext.setRevocableMemoryReservation(partition.get().getInMemorySizeInBytes()); } else { operatorContext.setMemoryReservation(partition.get().getInMemorySizeInBytes()); } lookupSourceNotNeeded = Optional.of(lookupSourceFactory.lendPartitionLookupSource(partitionIndex, partition)); state = State.LOOKUP_SOURCE_BUILT; }
Source:
public void checkAttributeSemantics(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException { if(attribute.valueAsInteger() == null) { throw new WrongReferenceAttributeValueException(attribute, "account expiration time shouldn't be null"); } }

Target:
public void checkAttributeSemantics(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws WrongReferenceAttributeValueException { if(attribute.getValue() == null) { throw new WrongReferenceAttributeValueException(attribute, null, facility, null, "account expiration time shouldn't be null"); } }
Source:
public Tuple next() { if ( hasNext ) { Tuple current = createTuple( entityMap, next ); next = next( iterator ); return current; } return null; }

Target:
public Tuple next() { if ( hasNext ) { Tuple current = createTuple( entityMap, next ); next = next( iterator ); return current; } throw new NoSuchElementException(); }
Source:
public Event createEvent(MessageDescription description) { log.debug("Processing pubsub event with payload {}", description.getMessagePayload()); try { description.setArtifacts(parseArtifacts(description.getMessagePayload())); } catch (FatalTemplateErrorsException e) { log.error("Template failed to process artifacts for message {}", description, e); } Event event = new Event(); Map<String, Object> content = new HashMap<>(); Metadata details = new Metadata(); try { event.setPayload(objectMapper.readValue(description.getMessagePayload(), Map.class)); } catch (IOException e) { log.warn("Could not parse message payload as JSON", e); } content.put("messageDescription", description); details.setType(PubsubEventHandler.PUBSUB_TRIGGER_TYPE); if (description.getMessageAttributes() != null) { details.setAttributes(description.getMessageAttributes()); } event.setContent(content); event.setDetails(details); return event; }

Target:
public Event createEvent(MessageDescription description) { log.trace("Processing pubsub event with payload {}", description.getMessagePayload()); try { description.setArtifacts(parseArtifacts(description.getMessagePayload())); } catch (FatalTemplateErrorsException e) { log.error("Template failed to process artifacts for message {}", description, e); } Event event = new Event(); Map<String, Object> content = new HashMap<>(); Metadata details = new Metadata(); try { event.setPayload(objectMapper.readValue(description.getMessagePayload(), Map.class)); } catch (IOException e) { log.warn("Could not parse message payload as JSON", e); } content.put("messageDescription", description); details.setType(PubsubEventHandler.PUBSUB_TRIGGER_TYPE); if (description.getMessageAttributes() != null) { details.setAttributes(description.getMessageAttributes()); } event.setContent(content); event.setDetails(details); return event; }
Source:
public void shouldIncludeMotoFlagWhenChargeIsMoto() { when(charge.isMoto()).thenReturn(true); StripePaymentIntentRequest stripePaymentIntentRequest = createStripePaymentIntentRequest(); String payload = stripePaymentIntentRequest.getGatewayOrder().getPayload(); assertThat(payload, containsString("payment_method_options%5Bcard%5Bmoto%5D%5D=true")); }

Target:
public void shouldIncludeMotoFlagWhenChargeIsMoto() { when(charge.isMoto()).thenReturn(true); StripePaymentIntentRequest stripePaymentIntentRequest = createStripePaymentIntentRequest(); String payload = stripePaymentIntentRequest.getGatewayOrder().getPayload(); assertThat(payload, containsString(URLEncoder.encode("payment_method_options[card[moto]]", UTF_8) + "=true")); }
Source:
public static Enum toEnum(final Ds3Type ds3Type) { final EnumConverter converter = new EnumConverter(ds3Type); return converter.convert(); }

Target:
public static Enum toEnum(final Ds3Type ds3Type) { final ImmutableList<String> valuesList = EnumHelper.convertDs3EnumConstants(ds3Type.getEnumConstants()); return new Enum( ds3Type.getName(), valuesList); }
Source:
private Map<String,String> transform(List<TParameterDTO> params){ Map<String,String> result = new HashMap<String,String>(); for(TParameterDTO param: params) { result.put(param.getName(), param.getValue()); } return result; }

Target:
private Map<String, String> transform(List<TParameterDTO> params) { return params.stream().collect(Collectors.toMap(TParameterDTO::getName, TParameterDTO::getValue)); }
Source:
private Map<String, DurableExecutorConfig> durableExecutorConfigs( List<DurableExecutorConfiguration> durableExecutors ) { return durableExecutors.stream() .map( durableExecutor -> { final var dec = new DurableExecutorConfig( durableExecutor.getName() ) .setPoolSize( durableExecutor.getPoolSize() ) .setCapacity( durableExecutor.getCapacity() ) .setDurability( durableExecutor.getDurability() ); if ( durableExecutor.getSplitBrainProtectionName() != null && !durableExecutor.getSplitBrainProtectionName().isBlank() ) { dec.setSplitBrainProtectionName( durableExecutor.getSplitBrainProtectionName() ); } return dec; } ) .collect( Collectors.toMap( DurableExecutorConfig::getName, Function.identity() ) ); }

Target:
private Map<String, DurableExecutorConfig> durableExecutorConfigs( List<DurableExecutorConfiguration> durableExecutors ) { return durableExecutors.stream() .map( durableExecutor -> { final var dec = new DurableExecutorConfig( durableExecutor.getName() ) .setPoolSize( durableExecutor.getPoolSize() ) .setCapacity( durableExecutor.getCapacity() ) .setDurability( durableExecutor.getDurability() ); if ( StringUtils.isNotBlank( durableExecutor.getSplitBrainProtectionName() ) ) { dec.setSplitBrainProtectionName( durableExecutor.getSplitBrainProtectionName() ); } return dec; } ) .collect( Collectors.toMap( DurableExecutorConfig::getName, Function.identity() ) ); }
Source:
public void setUp() throws Exception { executeDataSet("logEntriesTestDataset.xml"); this.service = Context.getService(IdentifierSourceService.class); }

Target:
public void setUp() throws Exception { executeDataSet("org/openmrs/module/idgen/include/TestData.xml"); }
Source:
protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("zoneName", name) .add("zoneState", zoneState); }

Target:
protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("name", name) .add("state", state); }
Source:
private synchronized void flushInternal(boolean isClose) throws IOException { try { maybeThrowLastError(); } catch (IOException e) { if (isClose) { throw new IOException("Skipping final flush and write due to " + e, e); } else throw e; } writeCurrentBufferToService(); flushWrittenBytesToService(isClose); }

Target:
private synchronized void flushInternal(boolean isClose) throws IOException { maybeThrowLastError(); writeCurrentBufferToService(); flushWrittenBytesToService(isClose); }
Source:
public void postUpdateCommand(Class<?> commandType, IEnabledTarget action) { boolean hasMultipleWindows = PlatformUI.getWorkbench().getWorkbenchWindowCount() >= 2; synchronized (fCommandUpdates) { if (!hasMultipleWindows) { Job.getJobManager().cancel(commandType); } List<IEnabledTarget> actions = fCommandUpdates.get(commandType); if (actions == null) { actions = new ArrayList<>(); fCommandUpdates.put(commandType, actions); } actions.add(action); } }

Target:
public void postUpdateCommand(Class<?> commandType, IEnabledTarget action) { boolean hasMultipleWindowServices = hasMultipleWindowServices(); synchronized (fCommandUpdates) { if (!hasMultipleWindowServices) { Job.getJobManager().cancel(commandType); } List<IEnabledTarget> actions = fCommandUpdates.get(commandType); if (actions == null) { actions = new ArrayList<>(); fCommandUpdates.put(commandType, actions); } actions.add(action); } }
Source:
public boolean enableNetwork(int netId, boolean disableOthers) { enforceChangePermission(); mLog.trace("enableNetwork uid=%").c(Binder.getCallingUid()).flush(); if (mWifiStateMachineChannel != null) { return mWifiStateMachine.syncEnableNetwork(mWifiStateMachineChannel, netId, disableOthers); } else { Slog.e(TAG, "mWifiStateMachineChannel is not initialized"); return false; } }

Target:
public boolean enableNetwork(int netId, boolean disableOthers) { enforceChangePermission(); mLog.trace("enableNetwork uid=% disableOthers=%") .c(Binder.getCallingUid()) .c(disableOthers ? "true" : "false").flush(); if (mWifiStateMachineChannel != null) { return mWifiStateMachine.syncEnableNetwork(mWifiStateMachineChannel, netId, disableOthers); } else { Slog.e(TAG, "mWifiStateMachineChannel is not initialized"); return false; } }
Source:
private CPPASTStructuredBindingDeclaration getStructuredBindingDeclaration() { IASTNode definition = getDefinition(); if (definition != null) { IASTNode parent = definition.getParent(); if (parent instanceof CPPASTStructuredBindingDeclaration) { return (CPPASTStructuredBindingDeclaration) parent; } } return null; }

Target:
private ICPPASTStructuredBindingDeclaration getStructuredBindingDeclaration() { IASTNode definition = getDefinition(); if (definition != null) { IASTNode parent = definition.getParent(); if (parent instanceof ICPPASTStructuredBindingDeclaration) { return (ICPPASTStructuredBindingDeclaration) parent; } } return null; }
Source:
private MultiValueMap<String, String> buildFormParameters(OAuth2AuthorizationCodeGrantRequest authorizationCodeGrantRequest) { ClientRegistration clientRegistration = authorizationCodeGrantRequest.getClientRegistration(); OAuth2AuthorizationExchange authorizationExchange = authorizationCodeGrantRequest.getAuthorizationExchange(); MultiValueMap<String, String> formParameters = new LinkedMultiValueMap<>(); formParameters.add(OAuth2ParameterNames.GRANT_TYPE, authorizationCodeGrantRequest.getGrantType().getValue()); formParameters.add(OAuth2ParameterNames.CODE, authorizationExchange.getAuthorizationResponse().getCode()); formParameters.add(OAuth2ParameterNames.REDIRECT_URI, authorizationExchange.getAuthorizationRequest().getRedirectUri()); if (ClientAuthenticationMethod.POST.equals(clientRegistration.getClientAuthenticationMethod())) { formParameters.add(OAuth2ParameterNames.CLIENT_ID, clientRegistration.getClientId()); formParameters.add(OAuth2ParameterNames.CLIENT_SECRET, clientRegistration.getClientSecret()); } else if (ClientAuthenticationMethod.NONE.equals(clientRegistration.getClientAuthenticationMethod())) { formParameters.add(OAuth2ParameterNames.CLIENT_ID, clientRegistration.getClientId()); formParameters.add(PkceParameterNames.CODE_VERIFIER, (String) authorizationExchange.getAuthorizationRequest().getAttributes().get(PkceParameterNames.CODE_VERIFIER)); } return formParameters; }

Target:
private MultiValueMap<String, String> buildFormParameters(OAuth2AuthorizationCodeGrantRequest authorizationCodeGrantRequest) { ClientRegistration clientRegistration = authorizationCodeGrantRequest.getClientRegistration(); OAuth2AuthorizationExchange authorizationExchange = authorizationCodeGrantRequest.getAuthorizationExchange(); MultiValueMap<String, String> formParameters = new LinkedMultiValueMap<>(); formParameters.add(OAuth2ParameterNames.GRANT_TYPE, authorizationCodeGrantRequest.getGrantType().getValue()); formParameters.add(OAuth2ParameterNames.CODE, authorizationExchange.getAuthorizationResponse().getCode()); String redirectUri = authorizationExchange.getAuthorizationRequest().getRedirectUri(); String codeVerifier = authorizationExchange.getAuthorizationRequest().getAttribute(PkceParameterNames.CODE_VERIFIER); if (redirectUri != null) { formParameters.add(OAuth2ParameterNames.REDIRECT_URI, redirectUri); } if (!ClientAuthenticationMethod.BASIC.equals(clientRegistration.getClientAuthenticationMethod())) { formParameters.add(OAuth2ParameterNames.CLIENT_ID, clientRegistration.getClientId()); } if (ClientAuthenticationMethod.POST.equals(clientRegistration.getClientAuthenticationMethod())) { formParameters.add(OAuth2ParameterNames.CLIENT_SECRET, clientRegistration.getClientSecret()); } if (codeVerifier != null) { formParameters.add(PkceParameterNames.CODE_VERIFIER, codeVerifier); } return formParameters; }
Source:
public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot) { boolean fromInvalid = from.func_190926_b(), toInvalid = to.func_190926_b(); if (fromInvalid && toInvalid) return false; if (fromInvalid || toInvalid) return true; boolean changed = false; if (slot != -1) { changed = slot != slotMainHand; slotMainHand = slot; } return from.getItem().shouldCauseReequipAnimation(from, to, changed); }

Target:
public static boolean shouldCauseReequipAnimation(@Nonnull ItemStack from, @Nonnull ItemStack to, int slot) { boolean fromInvalid = from.func_190926_b(); boolean toInvalid = to.func_190926_b(); if (fromInvalid && toInvalid) return false; if (fromInvalid || toInvalid) return true; boolean changed = false; if (slot != -1) { changed = slot != slotMainHand; slotMainHand = slot; } return from.getItem().shouldCauseReequipAnimation(from, to, changed); }
Source:
private static void deleteDir(HdfsContext context, HdfsEnvironment hdfsEnvironment, Path path, boolean recursive) { try { hdfsEnvironment.getFileSystem(context, path).delete(path, recursive); } catch (Exception e) { Logger.get(GlueHiveMetastore.class).warn(e, "Failed to delete path: " + path.toString()); } }

Target:
private static void deleteDir(HdfsContext context, HdfsEnvironment hdfsEnvironment, Path path, boolean recursive) { try { hdfsEnvironment.getFileSystem(context, path).delete(path, recursive); } catch (Exception e) { log.warn(e, "Failed to delete path: " + path.toString()); } }
Source:
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { clear(); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } if (value instanceof JSeparator) { return (JSeparator)value; } if (value instanceof String) { append((String)value); return this; } if (!(value instanceof ThemeEditorStyle)) { return null; } ThemeEditorStyle style = (ThemeEditorStyle)value; ThemeEditorStyle parent = style.getParent(); String styleName = style.getSimpleName(); String parentName = parent != null ? parent.getSimpleName() : null; if (!isSelected && style.isProjectStyle() && parentName != null && styleName.startsWith(parentName)) { append(parentName, SimpleTextAttributes.GRAY_ATTRIBUTES); append(".", SimpleTextAttributes.GRAY_ATTRIBUTES); append(styleName.substring(parentName.length() + 1), SimpleTextAttributes.REGULAR_ATTRIBUTES); } else { append(styleName, SimpleTextAttributes.REGULAR_ATTRIBUTES); } return this; }

Target:
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof JSeparator) { return (JSeparator)value; } clear(); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } if (value instanceof String) { append((String)value); return this; } if (!(value instanceof ThemeEditorStyle)) { return null; } ThemeEditorStyle style = (ThemeEditorStyle)value; ThemeEditorStyle parent = style.getParent(); String styleName = style.getSimpleName(); String parentName = parent != null ? parent.getSimpleName() : null; if (!isSelected && style.isProjectStyle() && parentName != null && styleName.startsWith(parentName)) { append(parentName, SimpleTextAttributes.GRAY_ATTRIBUTES); append(".", SimpleTextAttributes.GRAY_ATTRIBUTES); append(styleName.substring(parentName.length() + 1), SimpleTextAttributes.REGULAR_ATTRIBUTES); } else { append(styleName, SimpleTextAttributes.REGULAR_ATTRIBUTES); } return this; }
Source:
public static GroupTypeDescription getGroupTypeDescription(Object actual) { Class<?> c = actual.getClass(); if (Thread.currentThread().getStackTrace()[5].getClassName().contains("Spliterators")) return new GroupTypeDescription("spliterator characteristics", "characteristics"); if (actual instanceof Map) return new GroupTypeDescription("map", "map entries"); if (c.isArray() && c.getComponentType().isPrimitive()) return new GroupTypeDescription("array " + c.getSimpleName(), c.getComponentType().getSimpleName()); if (c.isArray()) return new GroupTypeDescription("array " + c.getSimpleName(), "elements"); return new GroupTypeDescription(c.getSimpleName(), "elements"); }

Target:
public static GroupTypeDescription getGroupTypeDescription(Object actual) { Class<?> c = actual.getClass(); if (Thread.currentThread().getStackTrace()[SPLITERATORS_CLASS_STACK_TRACE_NUM].getClassName().contains("Spliterators")) return new GroupTypeDescription("spliterator characteristics", "characteristics"); if (actual instanceof Map) return new GroupTypeDescription("map", "map entries"); if (c.isArray() && c.getComponentType().isPrimitive() || actual instanceof String[]) return new GroupTypeDescription("array " + c.getSimpleName(), c.getComponentType().getSimpleName()); if (c.isArray()) return new GroupTypeDescription("array " + c.getSimpleName(), "elements"); return new GroupTypeDescription(c.getSimpleName(), "elements"); }
Source:
public DSpaceCommandLineParameter(String parameter) { this(StringUtils.substringBefore(parameter, " "), StringUtils.substringAfter(parameter, " ")); }

Target:
protected DSpaceCommandLineParameter(String parameter) { this(StringUtils.substringBefore(parameter, " "), StringUtils.substringAfter(parameter, " ")); }
Source:
public void shouldUseAddedServiceCallListenerToInjectedStandaloneClientFactory() { TestService testService = standaloneFactory.getServiceProxy(TestService.class, null); ServiceCallListener listener = mock(ServiceCallListener.class); ((RatelServiceCallPublisher) standaloneFactory).addRatelServiceCallListener(listener); ProcessContext.getInstance().setProcessIdentifier("123"); TestServiceCallListener serverSideListener = startedApp.getBean(TestServiceCallListener.class); final String result = testService.hello(); assertThat(result).isEqualTo("success"); verify(listener, times(1)).remoteServiceCalled(any(RemoteServiceCallEvent.class)); verify(listener, times(1)).remoteServiceResponded(any(RemoteServiceResponseEvent.class)); verify(listener, times(0)).serviceInstanceCalled(any(ServiceInstanceCallEvent.class)); verify(listener, times(0)).serviceInstanceResponded(any(ServiceInstanceResponseEvent.class)); assertRecordedProcessId(serverSideListener.getServiceCallEvent(), "123"); assertRecordedProcessId(serverSideListener.getServiceResponseEvent(), "123"); }

Target:
public void shouldUseAddedServiceCallListenerToInjectedStandaloneClientFactory() { TestService testService = standaloneFactory.getServiceProxy(TestService.class); ServiceCallListener listener = mock(ServiceCallListener.class); ((RatelServiceCallPublisher) standaloneFactory).addRatelServiceCallListener(listener); ProcessContext.getInstance().setProcessIdentifier("123"); TestServiceCallListener serverSideListener = startedApp.getBean(TestServiceCallListener.class); final String result = testService.hello(); assertThat(result).isEqualTo("success"); verify(listener, times(1)).remoteServiceCalled(any(RemoteServiceCallEvent.class)); verify(listener, times(1)).remoteServiceResponded(any(RemoteServiceResponseEvent.class)); verify(listener, times(0)).serviceInstanceCalled(any(ServiceInstanceCallEvent.class)); verify(listener, times(0)).serviceInstanceResponded(any(ServiceInstanceResponseEvent.class)); assertRecordedProcessId(serverSideListener.getServiceCallEvent(), "123"); assertRecordedProcessId(serverSideListener.getServiceResponseEvent(), "123"); }
Source:
protected Boolean asBooleanEmpty(String value) { value = value.trim(); if (StringUtils.isEmpty(value)) { return null; } if (value.equalsIgnoreCase("t") || value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("y")) { return true; } try { double numValue = Double.parseDouble(value); if (numValue > 0) { return true; } } catch (final NumberFormatException ex) { LOGGER.error("Could not parse " + value + " as an integer"); } return false; }

Target:
protected Boolean asBooleanEmpty(String value) { value = value.trim(); if (StringUtils.isEmpty(value)) { return null; } return parseBoolean(value); }
Source:
public void getSetBits(int[] offsets, int numOffsets, int offsetBase, int numBits, boolean[] vector) throws IOException { if (offsets[0] == offsetBase && offsets[numOffsets - 1] == offsetBase + numOffsets - 1) { getSetBits(numOffsets, vector); if (numBits > offsets[numOffsets - offsetBase - 1] + 1) { skip(numBits - offsets[numOffsets - 1] - offsetBase - 1); } return; } int position = 0; for (int i = 0; i < numOffsets; i++) { int target = offsets[i] - offsetBase; if (target > position) { skip(target - position); position = target; } vector[i] = nextBit(); position++; } if (numBits > offsets[numOffsets - 1] - offsetBase) { skip(offsets[numOffsets - 1] - offsetBase - position); } }

Target:
public void getSetBits(int[] offsets, int numOffsets, int offsetBase, int numBits, boolean[] vector) throws IOException { if (offsets[0] == offsetBase && offsets[numOffsets - 1] == offsetBase + numOffsets - 1) { getSetBits(numOffsets, vector); if (numBits > numOffsets) { skip(numBits - numOffsets); } return; } int previousOffset = offsetBase; for (int i = 0; i < numOffsets; i++) { int delta = offsets[i] - previousOffset; if (delta > 0) { skip(delta); previousOffset += delta; } vector[i] = nextBit(); previousOffset++; } if (numBits > previousOffset - offsetBase) { skip(numBits - (previousOffset - offsetBase)); } }
Source:
private HandlerRequest<EmptyRequestBody, TaskManagerMessageParameters> createRequest() throws HandlerRequestException { Map<String, String> pathParamaters = new HashMap<>(); pathParamaters.put(TaskManagerIdPathParameter.KEY, taskManagerId.toString()); return new HandlerRequest<>( EmptyRequestBody.getInstance(), new TaskManagerFileMessageParameters(), pathParamaters, Collections.emptyMap() ); }

Target:
private static HandlerRequest<EmptyRequestBody, TaskManagerMessageParameters> createRequest() throws HandlerRequestException { Map<String, String> pathParameters = new HashMap<>(); pathParameters.put(TaskManagerIdPathParameter.KEY, TASK_MANAGER_ID.toString()); return new HandlerRequest<>( EmptyRequestBody.getInstance(), new TaskManagerFileMessageParameters(), pathParameters, Collections.emptyMap() ); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DimensionSelectorHavingSpec that = (DimensionSelectorHavingSpec) o; if (value != null && that.value != null) { return value.equals(that.value); } if (value == null && that.value == null) { return true; } return false; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DimensionSelectorHavingSpec that = (DimensionSelectorHavingSpec) o; boolean valEquals = false; boolean dimEquals = false; if (value != null && that.value != null) { valEquals = value.equals(that.value); } else if (value == null && that.value == null) { valEquals = true; } if (dimension != null && that.dimension != null) { dimEquals = dimension.equals(that.dimension); } else if (dimension == null && that.dimension == null) { dimEquals = true; } return (valEquals && dimEquals); }
Source:
public void activate(String username) { ClientResource clientResource = sendActivationRequest(username); closeRestletConnection(clientResource); }

Target:
public void activate(String username) { ClientResource clientResource = null; try { clientResource = sendActivationRequest(username); } finally { if (clientResource != null) closeRestletConnection(clientResource); } }
Source:
private static void cachePut(final CacheKey key, final boolean value) { final LRUMap<CacheKey, Boolean> cache = SecuredItemImpl.CACHE.get(); if (cache != null) { cache.put(key, value); SecuredItemImpl.CACHE.set(cache); } }

Target:
private void cachePut(final CacheKey key, final boolean value) { final LRUMap<CacheKey, Boolean> cache = SecuredItemImpl.CACHE.get(); if (cache != null) { cache.put(key, value); SecuredItemImpl.CACHE.set(cache); } }
Source:
public void requestTicketOfTypeObjects() { User user = persistUser(); TicketType type = ticketTypeRepository.findByName(TEST_TICKET).get(); Ticket ticketToPersist = new Ticket(user, type); TicketOption pickupOption = ticketOptionRepository.findByName(PICKUP_SERVICE_OPTION).get(); ticketToPersist.addOption(pickupOption); TicketOption chMemberOption = ticketOptionRepository.findByName(CH_MEMBER_OPTION).get(); ticketToPersist.addOption(chMemberOption); List<TicketOption> options = Arrays.asList(pickupOption, chMemberOption); Set<TicketOption> optionSet = new HashSet<>(options); testEntityManager.persist(ticketToPersist); Ticket ticket = ticketService.requestTicketOfType(user, type, options); assertEquals(user, ticket.getOwner()); assertEquals(optionSet, ticket.getEnabledOptions()); assertEquals(type, ticket.getType()); }

Target:
public void requestTicketOfTypeObjects() { User user = persistUser(); TicketType type = ticketTypeRepository.findByName(TEST_TICKET) .orElseThrow(() -> new TicketTypeNotFoundException(TEST_TICKET)); TicketOption pickupOption = ticketOptionRepository.findByName(PICKUP_SERVICE_OPTION) .orElseThrow(TicketOptionNotFoundException::new); TicketOption chMemberOption = ticketOptionRepository.findByName(CH_MEMBER_OPTION).orElseThrow(TicketOptionNotFoundException::new); List<TicketOption> optionsList = Arrays.asList(chMemberOption, pickupOption); Ticket ticket = ticketService.requestTicketOfType(user, type, optionsList); assertEquals(user, ticket.getOwner()); assertThat(ticket.getEnabledOptions()).containsAll(Arrays.asList(pickupOption, chMemberOption)); assertEquals(type, ticket.getType()); }
Source:
public OpenShiftClientFactory( @Nullable @Named("che.infra.openshift.master_url") String masterUrl, @Nullable @Named("che.infra.openshift.username") String username, @Nullable @Named("che.infra.openshift.password") String password, @Nullable @Named("che.infra.openshift.oauth_token") String oauthToken, @Nullable @Named("che.infra.openshift.trust_certs") Boolean doTrustCerts) { OpenShiftConfigBuilder configBuilder = new OpenShiftConfigBuilder(); if (!isNullOrEmpty(masterUrl)) { configBuilder.withMasterUrl(masterUrl); } if (!isNullOrEmpty(username)) { configBuilder.withUsername(username); } if (!isNullOrEmpty(password)) { configBuilder.withPassword(password); } if (!isNullOrEmpty(oauthToken)) { configBuilder.withOauthToken(oauthToken); } if (doTrustCerts != null) { configBuilder.withTrustCerts(doTrustCerts); } this.client = new DefaultOpenShiftClient(configBuilder.build()); }

Target:
public OpenShiftClientFactory( @Nullable @Named("che.infra.openshift.master_url") String masterUrl, @Nullable @Named("che.infra.openshift.username") String username, @Nullable @Named("che.infra.openshift.password") String password, @Nullable @Named("che.infra.openshift.oauth_token") String oauthToken, @Nullable @Named("che.infra.openshift.trust_certs") Boolean doTrustCerts) { OpenShiftConfigBuilder configBuilder = new OpenShiftConfigBuilder(); if (!isNullOrEmpty(masterUrl)) { configBuilder.withMasterUrl(masterUrl); } if (!isNullOrEmpty(username)) { configBuilder.withUsername(username); } if (!isNullOrEmpty(password)) { configBuilder.withPassword(password); } if (!isNullOrEmpty(oauthToken)) { configBuilder.withOauthToken(oauthToken); } if (doTrustCerts != null) { configBuilder.withTrustCerts(doTrustCerts); } this.client = new UnclosableOpenShiftClient(configBuilder.build()); }
Source:
public boolean unlinkChildren(int[] IDs) { if (children.length == 0) return (IDs.length == 0); int size = children.length; for (int i = 0; i < IDs.length; i++) { int index = findChild(IDs[i]); if (index != -1) { children[i] = -1; size--; } } if (size == 0) { children = EMPTY_ARRAY; return true; } int[] result = new int[size]; int pos = 0; for (int element : children) { if (element == -1) continue; result[pos] = element; pos++; } return true; }

Target:
public boolean unlinkChildren(int[] IDs) { if (children.length == 0) return (IDs.length == 0); int size = children.length; for (int i = 0; i < IDs.length; i++) { int index = findChild(IDs[i]); if (index != -1) { children[i] = -1; size--; } } if (size == 0) { children = EMPTY_ARRAY; return true; } int[] result = new int[size]; int pos = 0; for (int child : children) { if (child == -1) continue; result[pos] = child; pos++; } return true; }
Source:
private void splitSegment(PlatformOutboundInstruction platformOutboundInstruction) { EventProcessorSegmentReference splitSegment = platformOutboundInstruction.getSplitEventProcessorSegment(); int segmentId = splitSegment.getSegmentIdentifier(); String processorName = splitSegment.getProcessorName(); try { eventProcessorController.splitSegment(processorName, segmentId); resultPublisher.publishSuccessFor(platformOutboundInstruction.getInstructionId()); } catch (Exception e) { logger.error("Failed to split segment for processor [{}]", segmentId, processorName, e); resultPublisher.publishFailureFor(platformOutboundInstruction.getInstructionId(), e); } }

Target:
private void splitSegment(PlatformOutboundInstruction platformOutboundInstruction) { EventProcessorSegmentReference splitSegment = platformOutboundInstruction.getSplitEventProcessorSegment(); int segmentId = splitSegment.getSegmentIdentifier(); String processorName = splitSegment.getProcessorName(); String errorMessage = format("Failed to split segment [%s] for processor [%s]", segmentId, processorName); try { if (!eventProcessorController.splitSegment(processorName, segmentId)) { throw new RuntimeException(errorMessage); } resultPublisher.publishSuccessFor(platformOutboundInstruction.getInstructionId()); } catch (Exception e) { logger.error(errorMessage, e); resultPublisher.publishFailureFor(platformOutboundInstruction.getInstructionId(), e); } }
Source:
protected String getSuiteFilter(Class<?> klass) throws Exception { String suiteFilter = System.getProperty(SUITE_FILTER_OVERRIDE_VARIABLE_NAME); if (StringUtils.isEmpty(suiteFilter)) { SuiteFilter suiteFilterAnnotation = klass.getAnnotation(SuiteFilter.class); if (suiteFilterAnnotation == null) { return null; } suiteFilter = suiteFilterAnnotation.value(); } return suiteFilter; }

Target:
protected String getSuiteFilter(Class<?> klass) throws Exception { String suiteFilter = System.getProperty(SUITE_FILTER_OVERRIDE_VARIABLE_NAME); if (StringUtils.isEmpty(suiteFilter)) { SuiteFilter suiteFilterAnnotation = klass.getAnnotation(SuiteFilter.class); return suiteFilterAnnotation == null?null:suiteFilterAnnotation.value(); } return suiteFilter; }
Source:
public static List<Question> getSurveyXQuestion(final List<Response> surveyXResponses, final List<Question> surveyXQuestions) { if (surveyXResponses.size() == surveyXQuestions.size()) { return Lists.newArrayList(); } final List<Integer> responded_question_ids = getRespondedQuestionIds(surveyXResponses); final List<Integer> responded_response_ids = getRespondedResponseIds(surveyXResponses); final List<Question> availableQuestions = Lists.newArrayList(); for (Question question : surveyXQuestions) { if (!Collections.disjoint(responded_question_ids, Lists.newArrayList(question.id))) { continue; } if (!question.dependencyResponse.isEmpty() && Collections.disjoint(responded_response_ids, question.dependencyResponse)) { continue; } availableQuestions.add(question); } return availableQuestions; }

Target:
public static List<Question> getSurveyXQuestion(final List<Response> surveyXResponses, final List<Question> surveyXQuestions) { if (surveyXResponses.size() == surveyXQuestions.size()) { return Lists.newArrayList(); } final List<Integer> responded_question_ids = getRespondedQuestionIds(surveyXResponses); final List<Integer> responded_response_ids = getRespondedResponseIds(surveyXResponses); final List<Question> availableQuestions = Lists.newArrayList(); for (final Question question : surveyXQuestions) { if (!Collections.disjoint(responded_question_ids, Lists.newArrayList(question.id))) { continue; } if (!question.dependencyResponse.isEmpty() && Collections.disjoint(responded_response_ids, question.dependencyResponse)) { continue; } availableQuestions.add(question); } return availableQuestions; }