Code example for Enumeration

Methods: nextElement

0
		Object element;
		if (myPeekStack.size() > 0) {
			element = myPeekStack.pop();
		} 
		else { 
			element = myEnumeration.nextElement();
		} 
		return element;
	} 
	 
	public Object peek() {
		Object peekValue;
		if (myPeekStack.size() == 0) {
			if (hasMoreElements()) { 
				peekValue = nextElement();
				myPeekStack.push(peekValue);
			} 
			else { 
				peekValue = null;
			} 
		}