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

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

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

Stack.removeElementAt介绍

暂无

代码示例

代码示例来源:origin: org.apidesign.bck2brwsr/emul

  1. /**
  2. * Removes the object at the top of this stack and returns that
  3. * object as the value of this function.
  4. *
  5. * @return The object at the top of this stack (the last item
  6. * of the <tt>Vector</tt> object).
  7. * @throws EmptyStackException if this stack is empty.
  8. */
  9. public synchronized E pop() {
  10. E obj;
  11. int len = size();
  12. obj = peek();
  13. removeElementAt(len - 1);
  14. return obj;
  15. }

代码示例来源:origin: jtulach/bck2brwsr

  1. /**
  2. * Removes the object at the top of this stack and returns that
  3. * object as the value of this function.
  4. *
  5. * @return The object at the top of this stack (the last item
  6. * of the <tt>Vector</tt> object).
  7. * @throws EmptyStackException if this stack is empty.
  8. */
  9. public synchronized E pop() {
  10. E obj;
  11. int len = size();
  12. obj = peek();
  13. removeElementAt(len - 1);
  14. return obj;
  15. }

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

  1. public T push(T obj){
  2. // remove everything between this and pointer
  3. // logger.info("pointer" + pointer);
  4. // logger.info("(stack.size() -1)" + (stack.size() -1));
  5. int diff = Math.abs(pointer - (stack.size()-1));
  6. T retVal = stack.push(obj);
  7. if(stack.size() > maxSize){
  8. stack.removeElementAt(0);
  9. }
  10. pointer = stack.size() - 1;
  11. return retVal;
  12. }

代码示例来源:origin: google/sagetv

  1. private void pushOp(Object o)
  2. {
  3. widgetOperations.push(o);
  4. while (widgetOperations.size() > uiMgr.getInt("studio_undo_depth", 100))
  5. widgetOperations.removeElementAt(0);
  6. undoMenuItem.setEnabled(true);
  7. }
  8. public boolean hasUndo() { return !widgetOperations.isEmpty(); }

代码示例来源:origin: ops4j/org.ops4j.pax.logging

  1. private void processPositionalParameters0(Collection<Field> required, boolean validateOnly, Stack<String> args) throws Exception {
  2. int max = -1;
  3. for (Field positionalParam : positionalParametersFields) {
  4. Range indexRange = Range.parameterIndex(positionalParam);
  5. max = Math.max(max, indexRange.max);
  6. @SuppressWarnings("unchecked")
  7. Stack<String> argsCopy = reverse((Stack<String>) args.clone());
  8. if (!indexRange.isVariable) {
  9. for (int i = argsCopy.size() - 1; i > indexRange.max; i--) {
  10. argsCopy.removeElementAt(i);
  11. }
  12. }
  13. Collections.reverse(argsCopy);
  14. for (int i = 0; i < indexRange.min && !argsCopy.isEmpty(); i++) { argsCopy.pop(); }
  15. Range arity = Range.parameterArity(positionalParam);
  16. assertNoMissingParameters(positionalParam, arity.min, argsCopy);
  17. if (!validateOnly) {
  18. applyOption(positionalParam, Parameters.class, arity, false, argsCopy, null);
  19. required.remove(positionalParam);
  20. }
  21. }
  22. // remove processed args from the stack
  23. if (!validateOnly && !positionalParametersFields.isEmpty()) {
  24. int processedArgCount = Math.min(args.size(), max < Integer.MAX_VALUE ? max + 1 : Integer.MAX_VALUE);
  25. for (int i = 0; i < processedArgCount; i++) { args.pop(); }
  26. }
  27. }

代码示例来源:origin: org.apache.qpid/qpid-broker-plugins-access-control

  1. stack.removeElementAt(0);
  2. if (stack.isEmpty())
  3. stack.removeElementAt(0);

相关文章