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

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

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

Stack.removeElementAt介绍

暂无

代码示例

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

/**
 * Removes the object at the top of this stack and returns that
 * object as the value of this function.
 *
 * @return  The object at the top of this stack (the last item
 *          of the <tt>Vector</tt> object).
 * @throws  EmptyStackException  if this stack is empty.
 */
public synchronized E pop() {
  E       obj;
  int     len = size();
  obj = peek();
  removeElementAt(len - 1);
  return obj;
}

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

/**
 * Removes the object at the top of this stack and returns that
 * object as the value of this function.
 *
 * @return  The object at the top of this stack (the last item
 *          of the <tt>Vector</tt> object).
 * @throws  EmptyStackException  if this stack is empty.
 */
public synchronized E pop() {
  E       obj;
  int     len = size();
  obj = peek();
  removeElementAt(len - 1);
  return obj;
}

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

public T push(T obj){
  // remove everything between this and pointer
  //		logger.info("pointer" + pointer);
  //		logger.info("(stack.size() -1)" + (stack.size() -1));
  int diff = Math.abs(pointer - (stack.size()-1));
  T retVal = stack.push(obj);
  if(stack.size() > maxSize){
    stack.removeElementAt(0);
  }
  pointer = stack.size() - 1;
  return retVal;
}

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

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

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

private void processPositionalParameters0(Collection<Field> required, boolean validateOnly, Stack<String> args) throws Exception {
  int max = -1;
  for (Field positionalParam : positionalParametersFields) {
    Range indexRange = Range.parameterIndex(positionalParam);
    max = Math.max(max, indexRange.max);
    @SuppressWarnings("unchecked")
    Stack<String> argsCopy = reverse((Stack<String>) args.clone());
    if (!indexRange.isVariable) {
      for (int i = argsCopy.size() - 1; i > indexRange.max; i--) {
        argsCopy.removeElementAt(i);
      }
    }
    Collections.reverse(argsCopy);
    for (int i = 0; i < indexRange.min && !argsCopy.isEmpty(); i++) { argsCopy.pop(); }
    Range arity = Range.parameterArity(positionalParam);
    assertNoMissingParameters(positionalParam, arity.min, argsCopy);
    if (!validateOnly) {
      applyOption(positionalParam, Parameters.class, arity, false, argsCopy, null);
      required.remove(positionalParam);
    }
  }
  // remove processed args from the stack
  if (!validateOnly && !positionalParametersFields.isEmpty()) {
    int processedArgCount = Math.min(args.size(), max < Integer.MAX_VALUE ? max + 1 : Integer.MAX_VALUE);
    for (int i = 0; i < processedArgCount; i++) { args.pop(); }
  }
}

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

stack.removeElementAt(0);
if (stack.isEmpty())
  stack.removeElementAt(0);

相关文章