Code example for Stack

Methods: isEmpty, peek, pop

0
	} 
	 
	//µÝ¹éÅжÏÊÇ·ñ»¹Óв˵¥ 
	@Override 
	public boolean hasNext() { 
		if (stack.isEmpty()) {
			return false; 
		} else { 
			Iterator<MenuComponent> iterator = stack.peek();
			if (!iterator.hasNext()) {//Èç¹ûûÓÐnext±íʾ²»ÊDz˵¥£¬ÊǸö²Ëµ¥Ïî
				stack.pop();
				return hasNext();//µÝ¹éµ÷Óà
			} else { 
				return true; 
			} 
		} 
	} 
 
	@Override 
	public MenuComponent next() { 
		if (hasNext()) {