java.util.ArrayList.removeIf()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中java.util.ArrayList.removeIf()方法的一些代码示例,展示了ArrayList.removeIf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayList.removeIf()方法的具体详情如下:
包路径:java.util.ArrayList
类名称:ArrayList
方法名:removeIf

ArrayList.removeIf介绍

暂无

代码示例

代码示例来源:origin: cloudfoundry/uaa

@Override
public boolean revokeApprovalsForUser(String userId, final String zoneId) {
  return store.removeIf(approval -> userId.equals(approval.getUserId()));
}

代码示例来源:origin: cloudfoundry/uaa

@Override
public boolean revokeApprovalsForClient(String clientId, final String zoneId) {
  return store.removeIf(approval -> clientId.equals(approval.getClientId()));
}

代码示例来源:origin: cloudfoundry/uaa

@Override
public boolean revokeApprovalsForClientAndUser(String clientId, String userId, final String zoneId) {
  return store.removeIf(
    approval ->
      clientId.equals(approval.getClientId()) &&
      userId.equals(approval.getUserId())
  );
}

代码示例来源:origin: apache/nifi

@Parameterized.Parameters(name = "{index}: {0}")
public static Collection<TestParams> data() {
  Map<Integer, int[]> typeWithPrecisionRange = new HashMap<>();
  typeWithPrecisionRange.put(TINYINT, range(1,3));
  typeWithPrecisionRange.put(SMALLINT, range(1,5));
  typeWithPrecisionRange.put(INTEGER, range(1,9));
  ArrayList<TestParams> params = new ArrayList<>();
  typeWithPrecisionRange.forEach( (sqlType, precisions) -> {
    for (int precision : precisions) {
      params.add(new TestParams(sqlType, precision, SIGNED));
      params.add(new TestParams(sqlType, precision, UNSIGNED));
    }
  });
  // remove cases that we know should fail
  params.removeIf(param ->
    param.sqlType == INTEGER
        &&
    param.precision == 9
        &&
    param.signed == UNSIGNED
  );
  return params;
}

代码示例来源:origin: leangen/graphql-spqr

public ExtensionList<E> dropAll(Predicate<? super E> filter) {
  super.removeIf(filter);
  return this;
}

代码示例来源:origin: shizuchengxuyuan/net.sz.java

@Override
public boolean removeIf(Predicate<? super E> filter) {
  synchronized (this) {
    return super.removeIf(filter); //To change body of generated methods, choose Tools | Templates.
  }
}

代码示例来源:origin: badoualy/kotlogram

@Override
public boolean removeIf(Predicate<? super T> filter) {
  return items.removeIf(filter);
}

代码示例来源:origin: stackoverflow.com

public static <T> List<T> conditionalRemove(ArrayList<T> list) {
  list.removeIf(new ConditionCheck<>());
  return list;
}

代码示例来源:origin: jillesvangurp/jsonj

@Override
public boolean removeIf(Predicate<? super JsonElement> filter) {
  if(immutable) {
    throw new IllegalStateException("object is immutable");
  }
  return super.removeIf(filter);
}

代码示例来源:origin: hneemann/Digital

/**
 * Removes all observers from the given class
 *
 * @param observerClass the class of observers to remove
 */
public void removeObserver(Class<? extends Observer> observerClass) {
  observers.removeIf(observer -> observer.getClass() == observerClass);
}

代码示例来源:origin: keeps/roda

public List<String> getAipIds(String transferredResource) {
 ArrayList<String> ret;
 List<String> aipIds = transferredResourceToAipIds.get(transferredResource);
 if (aipIds != null) {
  ret = new ArrayList<>(aipIds);
  ret.removeIf(s -> s.equals(Report.NO_OUTCOME_OBJECT_ID));
 } else {
  ret = new ArrayList<>();
 }
 return ret;
}

代码示例来源:origin: org.basex/basex

/**
 * Removes all jobs with the specified id from the list.
 * @param id job id
 */
public void remove(final String id) {
 list.removeIf(job -> id.equals(job.options.get(JobsOptions.ID)));
}

代码示例来源:origin: BaseXdb/basex

/**
 * Removes all jobs with the specified id from the list.
 * @param id job id
 */
public void remove(final String id) {
 list.removeIf(job -> id.equals(job.options.get(JobsOptions.ID)));
}

代码示例来源:origin: Texera/texera

/**
 * Removes an attribute from the schema builder if it exists.
 * 
 * @param attribute, the name of the attribute
 * @return this Builder object
 */
public Builder removeIfExists(String attribute) {
  checkNotNull(attribute);
  
  attributeList.removeIf((Attribute attr) -> attr.getName().equalsIgnoreCase(attribute));
  attributeNames.remove(attribute.toLowerCase());
  return this;
}

代码示例来源:origin: com.github.kristiankime/functional-collections

@Override
public GuavaImFList<E> removeIfCp(Predicate<? super E> filter) {
  ArrayList<E> list = toArrayList();
  list.removeIf(filter);
  return new GuavaImFList<E>(ImmutableList.copyOf(list));
}

代码示例来源:origin: com.github.kristiankime/functional-collections

@Override
public FList<E> removeIfCp(Predicate<? super E> filter) {
  ArrayList<E> data = Lists.newArrayList(inner);
  data.removeIf(filter);
  return builder(data).build();
}

代码示例来源:origin: woefe/ShoppingList

@Override
public boolean removeIf(Predicate<? super ListItem> filter) {
  boolean b = false;
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
    b = super.removeIf(filter);
  }
  if (b) {
    notifyListChanged(Event.newOther());
  }
  return b;
}

代码示例来源:origin: hneemann/Digital

/**
 * Removes the given state
 *
 * @param state the state to remove
 */
public void remove(State state) {
  states.remove(state);
  transitions.removeIf(t -> t.getStartState() == state || t.getTargetState() == state);
  wasModified(state, Movable.Property.REMOVED);
}

代码示例来源:origin: chungkwong/MathOCR

public void filterNoise(){
  int threhold=Environment.ENVIRONMENT.getInteger("NOISE_THREHOLD");
  if(threhold>0){
    components.removeIf((c)->c.getWidth()<=threhold&&c.getHeight()<=threhold);
  }
}
/**

代码示例来源:origin: Vazkii/Quark

@SubscribeEvent 
public void onPlayerLoggedIn(PlayerLoggedInEvent event) {
  if(event.player instanceof EntityPlayerMP) {
    ArrayList<IRecipe> recipes = Lists.newArrayList(CraftingManager.REGISTRY);
    recipes.removeIf((recipe) -> ignored.contains(recipe.getRegistryName().toString()) || recipe.getRecipeOutput().isEmpty());
    ((EntityPlayerMP) event.player).unlockRecipes(recipes);
    if(forceLimitedCrafting)
      event.player.world.getGameRules().setOrCreateGameRule("doLimitedCrafting", "true");
  }
}

相关文章