com.google.common.collect

## Class UnmodifiableIterator<E>

- java.lang.Object
- - com.google.common.collect.UnmodifiableIterator<E>

- All Implemented Interfaces:
    java.util.Iterator<E>
  Direct Known Subclasses:
    AbstractIterator, AbstractSequentialIterator, UnmodifiableListIterator

      @GwtCompatible
      public abstract class UnmodifiableIterator<E>
      extends java.lang.Object
      implements java.util.Iterator<E>

  An iterator that does not support `remove()`.

  `UnmodifiableIterator` is used primarily in conjunction with implementations of `ImmutableCollection`, such as `ImmutableList`. You can, however, convert an existing iterator to an `UnmodifiableIterator` using `Iterators.unmodifiableIterator(java.util.Iterator<T>)`.

  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `UnmodifiableIterator()` Constructor for use by subclasses.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `remove()` Deprecated. Unsupported operation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `hasNext, next`

- - ### Constructor Detail

    - #### UnmodifiableIterator

          protected UnmodifiableIterator()

      Constructor for use by subclasses.

  - ### Method Detail

    - #### remove

          @Deprecated
          public final void remove()

      Deprecated. Unsupported operation.
      Guaranteed to throw an exception and leave the underlying data unmodified.
      Specified by:
        `remove` in interface `java.util.Iterator<E>`
      Throws:
        `java.lang.UnsupportedOperationException` - always