class PrioritizedDeque implements Iterable<T> {

	public void prioritize(T element) {
		final Iterator<T> iterator = deque.iterator();
		// Already prioritized? Then, do not reorder elements.
		for (int i = 0; i < numPriorityElements && iterator.hasNext(); i++) {
			if (iterator.next() == element) {
				return;
			}
		}
		// If the next non-priority element is the given element, we can simply include it in the priority section
		if (iterator.hasNext() && iterator.next() == element) {
			numPriorityElements++;
			return;
		}
		// Remove the given element.
		while (iterator.hasNext()) {
			if (iterator.next() == element) {
				iterator.remove();
				break;
			}
		}
		addPriorityElement(element);
	}

}