Code example for LinkedList

Methods: iterator

0
			queue.clear();
		} 
	} 
	 
	public Iterator<T> iterator() {
		return queue.iterator();
	} 
	 
	/** 
	 * Pulls the next element from the queue. 
	 * This call blocks until an element is available. 
	 *  
	 * @return the first element in the queue 
	 *  
	 * @throws InterruptedException if interrupted while blocked 
	 */ 
	public T pull() throws InterruptedException { 
		synchronized (queue) {
			while (queue.isEmpty()) {
				queue.wait();
			}