diff --git a/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java index 111d337e1521..fdc418a73745 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java @@ -50,6 +50,9 @@ * verify() method, which is called after each sequence and is guaranteed to be called * using the latest values obtained from {@link IteratorTester#newTargetIterator()}. * + *

The value you pass to the parameter {@code steps} should be greater than the length of your + * iterator, so that this class can check that your iterator behaves correctly when it is exhausted. + * *

For example, to test {@link java.util.Collections#unmodifiableList(java.util.List) * Collections.unmodifiableList}'s iterator: * @@ -61,7 +64,7 @@ * Arrays.asList("a", "b", "c", "d", "e")); * IteratorTester iteratorTester = * new IteratorTester( - * 5, + * 6, * IteratorFeature.UNMODIFIABLE, * expectedElements, * IteratorTester.KnownOrder.KNOWN_ORDER) { @@ -75,7 +78,7 @@ * } * *

Note: It is necessary to use {@code IteratorTester.KnownOrder} as shown above, rather - * than {@code KnownOrder} directly, because otherwise the code is not compilable. + * than {@code KnownOrder} directly, because otherwise the code cannot be compiled. * * @author Kevin Bourrillion * @author Chris Povirk diff --git a/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java index 111d337e1521..fdc418a73745 100644 --- a/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java @@ -50,6 +50,9 @@ * verify() method, which is called after each sequence and is guaranteed to be called * using the latest values obtained from {@link IteratorTester#newTargetIterator()}. * + *

The value you pass to the parameter {@code steps} should be greater than the length of your + * iterator, so that this class can check that your iterator behaves correctly when it is exhausted. + * *

For example, to test {@link java.util.Collections#unmodifiableList(java.util.List) * Collections.unmodifiableList}'s iterator: * @@ -61,7 +64,7 @@ * Arrays.asList("a", "b", "c", "d", "e")); * IteratorTester iteratorTester = * new IteratorTester( - * 5, + * 6, * IteratorFeature.UNMODIFIABLE, * expectedElements, * IteratorTester.KnownOrder.KNOWN_ORDER) { @@ -75,7 +78,7 @@ * } * *

Note: It is necessary to use {@code IteratorTester.KnownOrder} as shown above, rather - * than {@code KnownOrder} directly, because otherwise the code is not compilable. + * than {@code KnownOrder} directly, because otherwise the code cannot be compiled. * * @author Kevin Bourrillion * @author Chris Povirk