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

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

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

Stack.removeAll介绍

暂无

代码示例

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

  1. @Override
  2. public synchronized boolean removeAll(Collection<?> c) {
  3. if (!(c instanceof Set<?>)) {
  4. c = new HashSet<>(c);
  5. }
  6. return super.removeAll(c);
  7. }

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

  1. private void updateRecentFilesMenu() {
  2. List<MenuItem> items = new ArrayList<>();
  3. List<File> filesToClear = new ArrayList<>();
  4. for (final File f : recentFiles) {
  5. if (f.exists() && f.isFile()) {
  6. CustomMenuItem item = new CustomMenuItem(new Label(f.getName()));
  7. item.setOnAction(e -> loadSourceFromFile(f));
  8. item.setMnemonicParsing(false);
  9. Tooltip.install(item.getContent(), new Tooltip(f.getAbsolutePath()));
  10. items.add(item);
  11. } else {
  12. filesToClear.add(f);
  13. }
  14. }
  15. recentFiles.removeAll(filesToClear);
  16. if (items.isEmpty()) {
  17. openRecentMenu.setDisable(true);
  18. return;
  19. }
  20. Collections.reverse(items);
  21. items.add(new SeparatorMenuItem());
  22. MenuItem clearItem = new MenuItem();
  23. clearItem.setText("Clear menu");
  24. clearItem.setOnAction(e -> {
  25. recentFiles.clear();
  26. openRecentMenu.setDisable(true);
  27. });
  28. items.add(clearItem);
  29. openRecentMenu.getItems().setAll(items);
  30. }

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

  1. current.removeAll(toRemove);

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

  1. current.removeAll(toRemove);

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

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

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

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

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

  1. private void removeLocalDefs(DefinitionInfo defInfo)
  2. {
  3. localDefsInScope.removeAll(defInfo.getAllLocalDefNames());
  4. }

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

  1. public void endScope(DefinitionInfo defInfo)
  2. {
  3. this.localDefsInScope.removeAll(defInfo.getAllLocalDefNames());
  4. }

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

  1. /**
  2. * finish all activity except activityName
  3. *
  4. * @param activityName (class.getName)
  5. */
  6. public void finishAllActivityExcept(String activityName) {
  7. if (null == mActivityStack || mActivityStack.size() <= 0) {
  8. return;
  9. }
  10. ArrayList<Activity> finishList = new ArrayList<>();
  11. for (Activity eachActivity : mActivityStack) {
  12. if (null == eachActivity) {
  13. continue;
  14. }
  15. if (!eachActivity.getClass().getName().equals(activityName)) {
  16. eachActivity.finish();
  17. finishList.add(eachActivity);
  18. }
  19. }
  20. mActivityStack.removeAll(finishList);
  21. finishList.clear();
  22. }

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

  1. /** note, it is usually preferred to use isAncestor() and swap the order, it is a cheaper method */
  2. public static boolean isDescendant(Entity ancestor, Entity potentialDescendant) {
  3. Set<Entity> inspected = Sets.newLinkedHashSet();
  4. Stack<Entity> toinspect = new Stack<Entity>();
  5. toinspect.add(ancestor);
  6. while (!toinspect.isEmpty()) {
  7. Entity e = toinspect.pop();
  8. if (e.getChildren().contains(potentialDescendant)) {
  9. return true;
  10. }
  11. inspected.add(e);
  12. toinspect.addAll(e.getChildren());
  13. toinspect.removeAll(inspected);
  14. }
  15. return false;
  16. }

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

  1. /**
  2. * Checks whether the descendants of the given ancestor contains the given potentialDescendant.
  3. * <p>
  4. * In this test, unlike in {@link #descendants(Entity)}, an entity is not counted as a descendant.
  5. * note, it is usually preferred to use isAncestor() and swap the order, it is a cheaper method.
  6. */
  7. public static boolean isDescendant(Entity ancestor, Entity potentialDescendant) {
  8. Set<Entity> inspected = Sets.newLinkedHashSet();
  9. Stack<Entity> toinspect = new Stack<Entity>();
  10. toinspect.add(ancestor);
  11. while (!toinspect.isEmpty()) {
  12. Entity e = toinspect.pop();
  13. if (e.getChildren().contains(potentialDescendant)) {
  14. return true;
  15. }
  16. inspected.add(e);
  17. toinspect.addAll(e.getChildren());
  18. toinspect.removeAll(inspected);
  19. }
  20. return false;
  21. }

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

  1. this.stackElements.removeAll(listElement);

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

  1. /**
  2. * Method to remove a Collection of objects from the Stack
  3. * @param elements The Collection
  4. * @return Whether the collection of elements were removed
  5. **/
  6. public boolean removeAll(Collection elements)
  7. {
  8. makeDirty();
  9. if (useCache)
  10. {
  11. loadFromStore();
  12. }
  13. boolean delegateSuccess = delegate.removeAll(elements);
  14. boolean backingSuccess = false;
  15. if (backingStore != null)
  16. {
  17. try
  18. {
  19. backingSuccess = backingStore.removeAll(ownerSM, elements);
  20. }
  21. catch (JDODataStoreException dse)
  22. {
  23. JPOXLogger.JDO.warn(LOCALISER.msg("SCO.ErrorExecutingMethod", "removeAll", fieldName, dse));
  24. backingSuccess = false;
  25. }
  26. }
  27. return (backingStore != null ? backingSuccess : delegateSuccess);
  28. }

相关文章