当前位置: 首页>>代码示例>>Java>>正文


Java Stack.iterator方法代码示例

本文整理汇总了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.
	}
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:25,代码来源:StepByStepExecutionComposite.java

示例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]));
	}
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:21,代码来源:StepByStepExecutionComposite.java


注:本文中的java.util.Stack.iterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。