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

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

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

Stack.insertElementAt介绍

暂无

代码示例

代码示例来源:origin: org.orbisgis/orbisgis-view

  1. private static void parseCommandLine(String[] args) {
  2. //Read parameters
  3. Stack<String> sargs=new Stack<String>();
  4. for(String arg : args) {
  5. sargs.insertElementAt(arg, 0);
  6. }
  7. while(!sargs.empty()) {
  8. String argument=sargs.pop();
  9. if(argument.contentEquals("-debug")) {
  10. DEBUG_MODE=true;
  11. }
  12. }
  13. }

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

  1. private static void parseCommandLine(String[] args) {
  2. //Read parameters
  3. Stack<String> sargs = new Stack<String>();
  4. for (String arg : args) {
  5. sargs.insertElementAt(arg, 0);
  6. }
  7. while (!sargs.empty()) {
  8. String argument = sargs.pop();
  9. if (argument.contentEquals("--debug")) {
  10. debugMode = true;
  11. } else if(argument.contentEquals("--nofailmode")) {
  12. noFailMode = true;
  13. }
  14. }
  15. }

代码示例来源:origin: org.microemu/microemu-javase

  1. public Object push(Object item) {
  2. if (!(item instanceof XMLItem)) {
  3. throw new ClassCastException(item.getClass().getName());
  4. }
  5. modified = true;
  6. if (items.size() > maxCapacity) {
  7. items.pop();
  8. }
  9. items.remove(item);
  10. if (items.empty()) {
  11. items.add(item);
  12. } else {
  13. items.insertElementAt(item, 0);
  14. }
  15. fireListener(item);
  16. return item;
  17. }

代码示例来源:origin: org.icepdf.os/icepdf-core

  1. public void eval(Stack stack) {
  2. float j = (Float) stack.pop();
  3. float n = (Float) stack.pop();
  4. // each sift consists of removing an element from the top of the
  5. // stack and inserting it between element n-1 and element n of the stack
  6. if (j > 0) {
  7. for (int i = 0; i < j; i++) {
  8. stack.insertElementAt(stack.lastElement(),
  9. (int) (stack.size() - (n)));
  10. // finish the move by poping the top;
  11. stack.pop();
  12. }
  13. }
  14. // each shift consists of removing an element n-1 off the stack
  15. // and pushing it on top of the stack
  16. else if (j < 0) {
  17. for (int i = 0, max = (int) -j; i < max; i++) {
  18. stack.push(stack.remove((int) (stack.size() - (n))));
  19. }
  20. }
  21. }
  22. };

代码示例来源:origin: net.sf.jiapi/jiapi-reflect

  1. Object dupx1 = stack.pop();
  2. stack.push(dupx1);
  3. stack.insertElementAt(dupx1, stack.size() - 2); // Duplicate the top operand stack value and insert two values down
  4. break;
  5. case Opcodes.DUP_X2:

相关文章