package org.xbib.datastructures.immutable;

import java.util.ListIterator;

/**
 * A list iterator that does not support {@link #remove}, {@link #add}, or {@link #set}.
 */
public abstract class UnmodifiableListIterator<E extends Object>
        extends UnmodifiableIterator<E> implements ListIterator<E> {
    /**
     * Constructor for use by subclasses.
     */
    protected UnmodifiableListIterator() {
    }

    /**
     * Guaranteed to throw an exception and leave the underlying data unmodified.
     *
     * @throws UnsupportedOperationException always
     */
    @Override
    public final void add(E e) {
        throw new UnsupportedOperationException();
    }

    /**
     * Guaranteed to throw an exception and leave the underlying data unmodified.
     *
     * @throws UnsupportedOperationException always
     */
    @Override
    public final void set(E e) {
        throw new UnsupportedOperationException();
    }
}
