1090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson/*
21d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Copyright (C) 2007 The Guava Authors
3090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson *
4090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * Licensed under the Apache License, Version 2.0 (the "License");
5090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * you may not use this file except in compliance with the License.
6090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * You may obtain a copy of the License at
7090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson *
8090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0
9090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson *
10090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * Unless required by applicable law or agreed to in writing, software
11090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
12090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * See the License for the specific language governing permissions and
14090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * limitations under the License.
15090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */
16090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
17090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonpackage com.google.common.collect;
18090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
19090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonimport com.google.common.annotations.GwtCompatible;
20090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
21090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonimport java.util.ListIterator;
22090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
23090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson/**
24090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * A list iterator which forwards all its method calls to another list
25090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * iterator. Subclasses should override one or more methods to modify the
26090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * behavior of the backing iterator as desired per the <a
27090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
28090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson *
29090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * @author Mike Bostock
301d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * @since 2.0 (imported from Google Collections Library)
31090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */
32090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson@GwtCompatible
33090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonpublic abstract class ForwardingListIterator<E> extends ForwardingIterator<E>
34090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson    implements ListIterator<E> {
35090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
361d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  /** Constructor for use by subclasses. */
371d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  protected ForwardingListIterator() {}
381d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert
39090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  @Override protected abstract ListIterator<E> delegate();
40090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
411d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  @Override
42090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  public void add(E element) {
43090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson    delegate().add(element);
44090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  }
45090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
461d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  @Override
47090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  public boolean hasPrevious() {
48090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson    return delegate().hasPrevious();
49090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  }
50090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
511d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  @Override
52090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  public int nextIndex() {
53090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson    return delegate().nextIndex();
54090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  }
55090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
561d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  @Override
57090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  public E previous() {
58090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson    return delegate().previous();
59090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  }
60090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
611d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  @Override
62090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  public int previousIndex() {
63090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson    return delegate().previousIndex();
64090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  }
65090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson
661d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert  @Override
67090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  public void set(E element) {
68090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson    delegate().set(element);
69090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson  }
70090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson}
71