Fixes #495 implement iterator for Tomcat leak detection.

pull/517/head
Brett Wooldridge 9 years ago
parent 3e0f8736fb
commit 48a8afd141

@ -23,6 +23,7 @@ import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.Spliterator; import java.util.Spliterator;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
@ -206,7 +207,25 @@ public final class FastList<T> extends ArrayList<T>
@Override @Override
public Iterator<T> iterator() public Iterator<T> iterator()
{ {
throw new UnsupportedOperationException(); return new Iterator<T>() {
private int index;
@Override
public boolean hasNext()
{
return index < size;
}
@Override
public T next()
{
if (index < size) {
return elementData[index++];
}
throw new NoSuchElementException("No more elements in FastList");
}
};
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

@ -12,7 +12,6 @@ import java.sql.SQLException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock; import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;

Loading…
Cancel
Save