本文整理汇总了Java中java.util.Stack.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java Stack.iterator方法的具体用法?Java Stack.iterator怎么用?Java Stack.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Stack
的用法示例。
在下文中一共展示了Stack.iterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setOperandStack
import java.util.Stack; //导入方法依赖的package包/类
/**
* Display the elements of the current frames' operand stack.
*/
private void setOperandStack() {
try {
// Empty the list.
this.operandStackList.removeAll();
// Get and process the elements.
Stack<Object> operandStack = this.application.getVirtualMachine().getCurrentFrame().getOperandStack();
Iterator<Object> iterator = operandStack.iterator();
Object[] reversedOrder = new Object[operandStack.size()];
int a = operandStack.size() - 1;
while (iterator.hasNext()) {
reversedOrder[a] = iterator.next();
a--;
}
// Display them in reversed order, so the topmost element of the stack is actually the tompost element in the List.
for (a = 0; a < reversedOrder.length; a++) {
this.operandStackList.add(formatVMObject(reversedOrder[a]));
}
} catch (ConcurrentModificationException e) {
// This exception might occur when the automated execution of instruction is too fast. Just silently ignore it.
}
}
示例2: setVirtualMachineStack
import java.util.Stack; //导入方法依赖的package包/类
/**
* Display the elements of the virtual machine stack.
*/
private void setVirtualMachineStack() {
// Empty the list.
this.virtualMachineStackList.removeAll();
// Get and process the elements.
Stack<Object> virtualMachineStack = this.application.getVirtualMachine().getStack();
Iterator<Object> iterator = virtualMachineStack.iterator();
Object[] reversedOrder = new Object[virtualMachineStack.size()];
int a = virtualMachineStack.size() - 1;
while (iterator.hasNext()) {
reversedOrder[a] = iterator.next();
a--;
}
// Display them in reversed order, so the topmost element of the stack is actually the topmost element in the List.
for (a = 0; a < reversedOrder.length; a++) {
this.virtualMachineStackList.add(formatVMObject(reversedOrder[a]));
}
}