View Javadoc
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  
17  package com.google.common.collect;
18  
19  import com.google.common.annotations.GwtCompatible;
20  
21  import 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
31  public 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     * @deprecated Unsupported operation.
41     */
42    @Deprecated @Override public final void add(E e) {
43      throw new UnsupportedOperationException();
44    }
45  
46    /**
47     * Guaranteed to throw an exception and leave the underlying data unmodified.
48     *
49     * @throws UnsupportedOperationException always
50     * @deprecated Unsupported operation.
51     */
52    @Deprecated @Override public final void set(E e) {
53      throw new UnsupportedOperationException();
54    }
55  }