import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;

public class ReverseIterator<T> implements Iterator<T> {
	private List<T> data;
	private int index;
	public ReverseIterator (List<T> data) {
		this.data = data;
		index = data.size()-1;
	}
	
	public boolean hasNext() {
		return (index>=0);
	}
	
	public T next() {
		if (hasNext()) {
			return data.get(index--);
		} else
			throw new NoSuchElementException();
	}
	
	public void remove() {
		throw new UnsupportedOperationException();
	}
}