Coverage Summary for Class: ForwardingListIterator (com.google.common.collect)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| ForwardingListIterator | 0% (0/1) | 0% (0/7) | 0% (0/7) |
1 /* 2 * Copyright (C) 2007 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 import com.google.errorprone.annotations.CanIgnoreReturnValue; 21 import java.util.ListIterator; 22 23 /** 24 * A list iterator which forwards all its method calls to another list iterator. Subclasses should 25 * override one or more methods to modify the behavior of the backing iterator as desired per the <a 26 * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. 27 * 28 * <p><b>{@code default} method warning:</b> This class forwards calls to <i>only some</i> {@code 29 * default} methods. Specifically, it forwards calls only for methods that existed <a 30 * href="https://docs.oracle.com/javase/7/docs/api/java/util/ListIterator.html">before {@code 31 * default} methods were introduced</a>. For newer methods, like {@code forEachRemaining}, it 32 * inherits their default implementations. When those implementations invoke methods, they invoke 33 * methods on the {@code ForwardingListIterator}. 34 * 35 * @author Mike Bostock 36 * @since 2.0 37 */ 38 @GwtCompatible 39 public abstract class ForwardingListIterator<E> extends ForwardingIterator<E> 40 implements ListIterator<E> { 41 42 /** Constructor for use by subclasses. */ 43 protected ForwardingListIterator() {} 44 45 @Override 46 protected abstract ListIterator<E> delegate(); 47 48 @Override 49 public void add(E element) { 50 delegate().add(element); 51 } 52 53 @Override 54 public boolean hasPrevious() { 55 return delegate().hasPrevious(); 56 } 57 58 @Override 59 public int nextIndex() { 60 return delegate().nextIndex(); 61 } 62 63 @CanIgnoreReturnValue 64 @Override 65 public E previous() { 66 return delegate().previous(); 67 } 68 69 @Override 70 public int previousIndex() { 71 return delegate().previousIndex(); 72 } 73 74 @Override 75 public void set(E element) { 76 delegate().set(element); 77 } 78 }