java.util.Stack.removeAll()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(145)

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

Stack.removeAll介绍

暂无

代码示例

代码示例来源:origin: org.apache.ant/ant

@Override
public synchronized boolean removeAll(Collection<?> c) {
  if (!(c instanceof Set<?>)) {
    c = new HashSet<>(c);
  }
  return super.removeAll(c);
}

代码示例来源:origin: pmd/pmd

private void updateRecentFilesMenu() {
  List<MenuItem> items = new ArrayList<>();
  List<File> filesToClear = new ArrayList<>();
  for (final File f : recentFiles) {
    if (f.exists() && f.isFile()) {
      CustomMenuItem item = new CustomMenuItem(new Label(f.getName()));
      item.setOnAction(e -> loadSourceFromFile(f));
      item.setMnemonicParsing(false);
      Tooltip.install(item.getContent(), new Tooltip(f.getAbsolutePath()));
      items.add(item);
    } else {
      filesToClear.add(f);
    }
  }
  recentFiles.removeAll(filesToClear);
  if (items.isEmpty()) {
    openRecentMenu.setDisable(true);
    return;
  }
  Collections.reverse(items);
  items.add(new SeparatorMenuItem());
  MenuItem clearItem = new MenuItem();
  clearItem.setText("Clear menu");
  clearItem.setOnAction(e -> {
    recentFiles.clear();
    openRecentMenu.setDisable(true);
  });
  items.add(clearItem);
  openRecentMenu.getItems().setAll(items);
}

代码示例来源:origin: geotools/geotools

current.removeAll(toRemove);

代码示例来源:origin: geotools/geotools

current.removeAll(toRemove);

代码示例来源:origin: CogComp/cogcomp-nlp

public boolean removeAll(Collection<?> c) {
  return stack.removeAll(c);
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities

public boolean removeAll(Collection<?> c) {
  return stack.removeAll(c);
}

代码示例来源:origin: overturetool/overture

private void removeLocalDefs(DefinitionInfo defInfo)
{
  localDefsInScope.removeAll(defInfo.getAllLocalDefNames());
}

代码示例来源:origin: overturetool/overture

public void endScope(DefinitionInfo defInfo)
{
  this.localDefsInScope.removeAll(defInfo.getAllLocalDefNames());
}

代码示例来源:origin: linqssonny/Utils

/**
 * finish all activity except activityName
 *
 * @param activityName (class.getName)
 */
public void finishAllActivityExcept(String activityName) {
  if (null == mActivityStack || mActivityStack.size() <= 0) {
    return;
  }
  ArrayList<Activity> finishList = new ArrayList<>();
  for (Activity eachActivity : mActivityStack) {
    if (null == eachActivity) {
      continue;
    }
    if (!eachActivity.getClass().getName().equals(activityName)) {
      eachActivity.finish();
      finishList.add(eachActivity);
    }
  }
  mActivityStack.removeAll(finishList);
  finishList.clear();
}

代码示例来源:origin: io.brooklyn/brooklyn-core

/** note, it is usually preferred to use isAncestor() and swap the order, it is a cheaper method */
public static boolean isDescendant(Entity ancestor, Entity potentialDescendant) {
  Set<Entity> inspected = Sets.newLinkedHashSet();
  Stack<Entity> toinspect = new Stack<Entity>();
  toinspect.add(ancestor);
  while (!toinspect.isEmpty()) {
    Entity e = toinspect.pop();
    if (e.getChildren().contains(potentialDescendant)) {
      return true;
    }
    inspected.add(e);
    toinspect.addAll(e.getChildren());
    toinspect.removeAll(inspected);
  }
  return false;
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

/**
 * Checks whether the descendants of the given ancestor contains the given potentialDescendant.
 * <p>
 * In this test, unlike in {@link #descendants(Entity)}, an entity is not counted as a descendant.
 * note, it is usually preferred to use isAncestor() and swap the order, it is a cheaper method.
 */
public static boolean isDescendant(Entity ancestor, Entity potentialDescendant) {
  Set<Entity> inspected = Sets.newLinkedHashSet();
  Stack<Entity> toinspect = new Stack<Entity>();
  toinspect.add(ancestor);
  while (!toinspect.isEmpty()) {
    Entity e = toinspect.pop();
    if (e.getChildren().contains(potentialDescendant)) {
      return true;
    }
    inspected.add(e);
    toinspect.addAll(e.getChildren());
    toinspect.removeAll(inspected);
  }
  return false;
}

代码示例来源:origin: de.alpharogroup/jaulp.xml

this.stackElements.removeAll(listElement);

代码示例来源:origin: jpox/jpox

/**
 * Method to remove a Collection of objects from the Stack
 * @param elements The Collection
 * @return Whether the collection of elements were removed
 **/
public boolean removeAll(Collection elements)
{
  makeDirty();
  if (useCache)
  {
    loadFromStore();
  }
  boolean delegateSuccess = delegate.removeAll(elements);
  boolean backingSuccess = false;
  if (backingStore != null)
  {
    try
    {
      backingSuccess = backingStore.removeAll(ownerSM, elements);
    }
    catch (JDODataStoreException dse)
    {
      JPOXLogger.JDO.warn(LOCALISER.msg("SCO.ErrorExecutingMethod", "removeAll", fieldName, dse));
      backingSuccess = false;
    }
  }
  return (backingStore != null ? backingSuccess : delegateSuccess);
}

相关文章