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

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

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

Stack.forEach介绍

暂无

代码示例

代码示例来源:origin: com.pragmaticobjects.oo.atom/atom-basis

  1. /**
  2. * Put the traces of what was collected by the recorder to the stdout.
  3. */
  4. public void trace() {
  5. recordedCalls.forEach(System.out::println);
  6. }

代码示例来源:origin: org.ballerinalang/ballerina-lang

  1. private void attachAnnotations(AnnotatableNode annotatableNode) {
  2. annotAttachmentStack.forEach(annotatableNode::addAnnotationAttachment);
  3. annotAttachmentStack.clear();
  4. }

代码示例来源:origin: io.github.therealmone/SPOParser

  1. private static String convertToString() {
  2. StringBuilder out = new StringBuilder();
  3. stack.forEach(command ->
  4. out.append(command).append(",")
  5. );
  6. out.deleteCharAt(out.length() - 1);
  7. return out.toString();
  8. }
  9. }

代码示例来源:origin: org.ballerinalang/ballerina-lang

  1. void startXMLElement(DiagnosticPos pos, Set<Whitespace> ws, boolean isRoot) {
  2. BLangXMLElementLiteral xmlElement = (BLangXMLElementLiteral) TreeBuilder.createXMLElementLiteralNode();
  3. BLangExpression startTag = (BLangExpression) exprNodeStack.pop();
  4. xmlElement.addWS(ws);
  5. xmlElement.startTagName = startTag;
  6. xmlElement.pos = pos;
  7. xmlElement.isRoot = isRoot;
  8. xmlAttributeNodeStack.forEach(xmlElement::addAttribute);
  9. xmlAttributeNodeStack.clear();
  10. addExpressionNode(xmlElement);
  11. }

代码示例来源:origin: asad/SMSD

  1. S_copy = new ArrayList<>();
  2. P.forEach((I) -> {
  3. P_Prime.add(I);
  4. });
  5. });
  6. P.forEach((obj) -> {
  7. P_copy.add(obj);
  8. });
  9. D.forEach((obj) -> {
  10. D_copy.add(obj);
  11. });

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

  1. /**
  2. * Completes the current client request. It registers the composite command into the
  3. * session's registry.
  4. */
  5. private void complete() {
  6. if (isRequestStarted()) {
  7. final boolean hasCommands = !commands.isEmpty();
  8. if (hasCommands && roolback) {
  9. LOGGER.log(Level.FINEST,
  10. "Performing rollback for commands in current requrest.");
  11. final AbstractCanvasHandler canvasHandler = getCurrentSession().getCanvasHandler();
  12. commands.forEach(c -> c.undo(canvasHandler));
  13. } else if (hasCommands) {
  14. // If any commands have been aggregated, let's composite them and add into the registry.
  15. LOGGER.log(Level.FINEST,
  16. "Adding commands for current request into registry [size=" + commands.size() + "]");
  17. getRegistry().register(new CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation>()
  18. .addCommands(commands.stream().collect(Collectors.toList()))
  19. .build());
  20. }
  21. LOGGER.log(Level.FINEST,
  22. "Current client request completed.");
  23. } else {
  24. LOGGER.log(Level.WARNING,
  25. "Current client request has not been started.");
  26. }
  27. clear();
  28. }

代码示例来源:origin: HuygensING/timbuctoo

  1. private CreateProperty convertToProperty(PredicateInUse pred) {
  2. Stack<ValueTypeInUse> valueTypes = pred.getValueTypes().stream()
  3. .sorted(comparingInt(o -> o.getEntitiesConnected().size()))
  4. .collect(toCollection(Stack::new));
  5. ValueTypeInUse type = valueTypes.pop();
  6. valueTypes.forEach(vt -> vt
  7. .getEntitiesConnected().forEach(e -> importErrorReporter
  8. .entityHasWrongTypeForProperty(e, pred.getPredicateUri(), type.getTypeUri(), vt.getTypeUri())
  9. )
  10. );
  11. return ImmutableCreateProperty.builder()
  12. .clientName(getPredicateName(pred))
  13. .rdfUri(pred.getPredicateUri())
  14. .typeUri(type.getTypeUri())
  15. .propertyType(getPropertyType(pred.getPredicateUri(), type))
  16. .build();
  17. }

相关文章