Coverage Summary for Class: TransformedListIterator (com.google.common.collect)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| TransformedListIterator | 0% (0/1) | 0% (0/8) | 0% (0/8) |
1 /* 2 * Copyright (C) 2012 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.common.base.Function; 21 import java.util.ListIterator; 22 23 /** 24 * An iterator that transforms a backing list iterator; for internal use. This avoids the object 25 * overhead of constructing a {@link Function} for internal methods. 26 * 27 * @author Louis Wasserman 28 */ 29 @GwtCompatible 30 abstract class TransformedListIterator<F, T> extends TransformedIterator<F, T> 31 implements ListIterator<T> { 32 TransformedListIterator(ListIterator<? extends F> backingIterator) { 33 super(backingIterator); 34 } 35 36 private ListIterator<? extends F> backingIterator() { 37 return Iterators.cast(backingIterator); 38 } 39 40 @Override 41 public final boolean hasPrevious() { 42 return backingIterator().hasPrevious(); 43 } 44 45 @Override 46 public final T previous() { 47 return transform(backingIterator().previous()); 48 } 49 50 @Override 51 public final int nextIndex() { 52 return backingIterator().nextIndex(); 53 } 54 55 @Override 56 public final int previousIndex() { 57 return backingIterator().previousIndex(); 58 } 59 60 @Override 61 public void set(T element) { 62 throw new UnsupportedOperationException(); 63 } 64 65 @Override 66 public void add(T element) { 67 throw new UnsupportedOperationException(); 68 } 69 }