1/*
2 * Copyright (C) 2010 The Guava Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.common.collect;
18
19import com.google.common.annotations.GwtCompatible;
20
21import java.util.ListIterator;
22
23/**
24 * A list iterator that does not support {@link #remove}, {@link #add}, or
25 * {@link #set}.
26 *
27 * @since 7.0
28 * @author Louis Wasserman
29 */
30@GwtCompatible
31public abstract class UnmodifiableListIterator<E>
32    extends UnmodifiableIterator<E> implements ListIterator<E> {
33  /** Constructor for use by subclasses. */
34  protected UnmodifiableListIterator() {}
35
36  /**
37   * Guaranteed to throw an exception and leave the underlying data unmodified.
38   *
39   * @throws UnsupportedOperationException always
40   */
41  @Override public final void add(E e) {
42    throw new UnsupportedOperationException();
43  }
44
45  /**
46   * Guaranteed to throw an exception and leave the underlying data unmodified.
47   *
48   * @throws UnsupportedOperationException always
49   */
50  @Override public final void set(E e) {
51    throw new UnsupportedOperationException();
52  }
53}
54