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

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

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

Stack.addAll介绍

暂无

代码示例

代码示例来源:origin: kiegroup/jbpm

public void addCompensationInstances(Collection<NodeInstance> generatedInstances) {
  this.compensationInstances.addAll(generatedInstances);
}

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

private synchronized void addTableNamesForPrewarming(List<String> tblNames) {
 tableNames.clear();
 if (tblNames != null) {
  tableNames.addAll(tblNames);
 }
}

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

public DirectoryIterator(File... basis) {
  this.stack = new Stack<File>();
  stack.addAll(Arrays.asList(basis));
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns true if a project has a non-direct dependency to another project.
 * <p>
 * A non-direct dependency is a path of dependency "edge"s from the source to the destination,
 * where the length is greater than 1.
 */
public boolean hasIndirectDependencies(AbstractProject src, AbstractProject dst) {
  Set<AbstractProject> visited = new HashSet<AbstractProject>();
  Stack<AbstractProject> queue = new Stack<AbstractProject>();
  queue.addAll(getDownstream(src));
  queue.remove(dst);
  while(!queue.isEmpty()) {
    AbstractProject p = queue.pop();
    if(p==dst)
      return true;
    if(visited.add(p))
      queue.addAll(getDownstream(p));
  }
  return false;
}

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

private Set<Class> findAllInterfacesInHierarchy(Class candidateGoExtensionClass) {
  Stack<Class> classesInHierarchy = new Stack<>();
  classesInHierarchy.add(candidateGoExtensionClass);
  Set<Class> interfaces = new HashSet<>();
  while (!classesInHierarchy.empty()) {
    Class classToCheckFor = classesInHierarchy.pop();
    if (classToCheckFor.isInterface()) {
      interfaces.add(classToCheckFor);
    }
    classesInHierarchy.addAll(Arrays.asList(classToCheckFor.getInterfaces()));
    if (classToCheckFor.getSuperclass() != null) {
      classesInHierarchy.add(classToCheckFor.getSuperclass());
    }
  }
  return interfaces;
}

代码示例来源:origin: stanfordnlp/CoreNLP

public void markOptional(boolean propagate) {
  this.isOptional = true;
  if (propagate && next != null) {
   Stack<State> todo = new Stack<>();
   Set<State> seen = new HashSet<>();
   todo.addAll(next);
   while (!todo.empty()) {
    State s = todo.pop();
    s.isOptional = true;
    seen.add(s);
    if (next != null) {
     for (State n : next) {
      if (!seen.contains(n)) {
       todo.push(n);
      }
     }
    }
   }
  }
 }
}

代码示例来源:origin: jphp-group/jphp

@Signature
synchronized public void __clone() {
  Stack<Memory> old = this.stack;
  this.stack = new Stack<Memory>();
  stack.addAll(old);
}

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

private Set<Operator<?>> getAllOperatorsForSimpleFetch(Set<Operator<?>> opSet) {
  Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>();
  Stack<Operator<?>> opStack = new Stack<Operator<?>>();
  // add all children
  opStack.addAll(opSet);
  while (!opStack.empty()) {
   Operator<?> op = opStack.pop();
   returnSet.add(op);
   if (op.getChildOperators() != null) {
    opStack.addAll(op.getChildOperators());
   }
  }
  return returnSet;
 }
}

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

private Set<Operator<?>> getAllOperatorsForSimpleFetch(Set<Operator<?>> opSet) {
  Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>();
  Stack<Operator<?>> opStack = new Stack<Operator<?>>();
  // add all children
  opStack.addAll(opSet);
  while (!opStack.empty()) {
   Operator<?> op = opStack.pop();
   returnSet.add(op);
   if (op.getChildOperators() != null) {
    opStack.addAll(op.getChildOperators());
   }
  }
  return returnSet;
 }
}

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

public Set<Operator<?>> getAllOperators() {
 Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>();
 Set<Operator<?>> opSet = getAllRootOperators();
 Stack<Operator<?>> opStack = new Stack<Operator<?>>();
 // add all children
 opStack.addAll(opSet);
 while(!opStack.empty()) {
  Operator<?> op = opStack.pop();
  returnSet.add(op);
  if (op.getChildOperators() != null) {
   opStack.addAll(op.getChildOperators());
  }
 }
 return returnSet;
}

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

public Set<Operator<?>> getAllOperators() {
 Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>();
 Set<Operator<?>> opSet = getAllRootOperators();
 Stack<Operator<?>> opStack = new Stack<Operator<?>>();
 // add all children
 opStack.addAll(opSet);
 while(!opStack.empty()) {
  Operator<?> op = opStack.pop();
  returnSet.add(op);
  if (op.getChildOperators() != null) {
   opStack.addAll(op.getChildOperators());
  }
 }
 return returnSet;
}

代码示例来源:origin: graphql-java/graphql-java

/**
 * This will decorate a graphql type with the original hierarchy of non null and list'ness
 * it originally contained in its definition type
 *
 * @param objectType this should be a graphql type that was originally built from this raw type
 * @param <T>        the type
 *
 * @return the decorated type
 */
@SuppressWarnings("TypeParameterUnusedInFormals")
public <T extends GraphQLType> T decorate(GraphQLType objectType) {
  GraphQLType out = objectType;
  Stack<Class<?>> wrappingStack = new Stack<>();
  wrappingStack.addAll(this.decoration);
  while (!wrappingStack.isEmpty()) {
    Class<?> clazz = wrappingStack.pop();
    if (clazz.equals(NonNullType.class)) {
      out = nonNull(out);
    }
    if (clazz.equals(ListType.class)) {
      out = list(out);
    }
  }
  // we handle both input and output graphql types
  //noinspection unchecked
  return (T) out;
}

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

/**
 * Returns a set containing all leaf operators from the operator tree in this work.
 * @return a set containing all leaf operators in this operator tree.
 */
public Set<Operator<? extends OperatorDesc>> getAllLeafOperators() {
 Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>();
 Set<Operator<?>> opSet = getAllRootOperators();
 Stack<Operator<?>> opStack = new Stack<Operator<?>>();
 // add all children
 opStack.addAll(opSet);
 while (!opStack.empty()) {
  Operator<?> op = opStack.pop();
  if (op.getNumChild() == 0) {
   returnSet.add(op);
  }
  if (op.getChildOperators() != null) {
   opStack.addAll(op.getChildOperators());
  }
 }
 return returnSet;
}

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

public static Set<Operator<?>> getOp(BaseWork work, Class<?> clazz) {
 Set<Operator<?>> ops = new HashSet<Operator<?>>();
 if (work instanceof MapWork) {
  Collection<Operator<?>> opSet = ((MapWork) work).getAliasToWork().values();
  Stack<Operator<?>> opStack = new Stack<Operator<?>>();
  opStack.addAll(opSet);
  while (!opStack.empty()) {
   Operator<?> op = opStack.pop();
   ops.add(op);
   if (op.getChildOperators() != null) {
    opStack.addAll(op.getChildOperators());
   }
  }
 } else {
  ops.addAll(work.getAllOperators());
 }
 Set<Operator<? extends OperatorDesc>> matchingOps =
  new HashSet<Operator<? extends OperatorDesc>>();
 for (Operator<? extends OperatorDesc> op : ops) {
  if (clazz.isInstance(op)) {
   matchingOps.add(op);
  }
 }
 return matchingOps;
}

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

@Override
protected void indexNodes(List<Node> nodes, RuleContext ctx) {
  Stack<Node> stack = new Stack<>();
  stack.addAll(nodes);
  Collections.reverse(stack);
  while (!stack.isEmpty()) {
    Node node = stack.pop();
    indexNode(node);
    if (node.jjtGetNumChildren() > 0) {
      for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) {
        stack.push(node.jjtGetChild(i));
      }
    }
  }
}

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

@Override
protected void indexNodes(List<Node> nodes, RuleContext ctx) {
  // Visit Nodes in DFS order
  Stack<Node> stack = new Stack<>();
  stack.addAll(nodes);
  Collections.reverse(stack);
  while (!stack.isEmpty()) {
    Node node = stack.pop();
    indexNode(node);
    if (node.jjtGetNumChildren() > 0) {
      for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) {
        stack.push(node.jjtGetChild(i));
      }
    }
  }
}

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

@Override
protected void indexNodes(List<Node> nodes, RuleContext ctx) {
  // Visit Nodes in DFS order
  Stack<Node> stack = new Stack<>();
  stack.addAll(nodes);
  Collections.reverse(stack);
  while (!stack.isEmpty()) {
    Node node = stack.pop();
    indexNode(node);
    if (node.jjtGetNumChildren() > 0) {
      for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) {
        stack.push(node.jjtGetChild(i));
      }
    }
  }
}

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

/**
 * Returns a set containing all leaf operators from the operator tree in this work.
 * @return a set containing all leaf operators in this operator tree.
 */
public Set<Operator<? extends OperatorDesc>> getAllLeafOperators() {
 Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>();
 Set<Operator<?>> opSet = getAllRootOperators();
 Stack<Operator<?>> opStack = new Stack<Operator<?>>();
 // add all children
 opStack.addAll(opSet);
 while (!opStack.empty()) {
  Operator<?> op = opStack.pop();
  if (op.getNumChild() == 0) {
   returnSet.add(op);
  }
  if (op.getChildOperators() != null) {
   opStack.addAll(op.getChildOperators());
  }
 }
 return returnSet;
}

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

static Stack transform(final List<LogEvent> logEvents) {
  final List<String> filtered = new ArrayList<>(logEvents.size());
  for (LogEvent event : logEvents) {
    filtered.add(event.getMessage().getFormattedMessage());
  }
  Collections.reverse(filtered);
  Stack<String> result = new Stack<>();
  result.addAll(filtered);
  return result;
}

代码示例来源:origin: remkop/picocli

/**
 * Entry point into parsing command line arguments.
 * @param args the command line arguments
 * @return a list with all commands and subcommands initialized by this method
 * @throws ParameterException if the specified command line arguments are invalid
 */
List<CommandLine> parse(String... args) {
  Assert.notNull(args, "argument array");
  if (tracer.isInfo()) {tracer.info("Picocli version: %s%n", versionString());}
  if (tracer.isInfo()) {tracer.info("Parsing %d command line args %s%n", args.length, Arrays.toString(args));}
  if (tracer.isDebug()){tracer.debug("Parser configuration: %s%n", config());}
  if (tracer.isDebug()){tracer.debug("(ANSI is %s by default: isatty=%s, XTERM=%s, OSTYPE=%s, isWindows=%s, JansiConsoleInstalled=%s, ANSICON=%s, ConEmuANSI=%s, NO_COLOR=%s, CLICOLOR=%s, CLICOLOR_FORCE=%s)%n",
      Help.Ansi.ansiPossible() ? "enabled" : "disabled", Help.Ansi.isTTY(), System.getenv("XTERM"), System.getenv("OSTYPE"), Help.Ansi.isWindows(), Help.Ansi.isJansiConsoleInstalled(), System.getenv("ANSICON"), System.getenv("ConEmuANSI"), System.getenv("NO_COLOR"), System.getenv("CLICOLOR"), System.getenv("CLICOLOR_FORCE"));}
  List<String> expanded = new ArrayList<String>();
  for (String arg : args) { addOrExpand(arg, expanded, new LinkedHashSet<String>()); }
  Stack<String> arguments = new Stack<String>();
  arguments.addAll(reverseList(expanded));
  List<CommandLine> result = new ArrayList<CommandLine>();
  parse(result, arguments, args, new ArrayList<Object>());
  return result;
}

相关文章