|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.collect.testing.MinimalIterable<E>
@GwtCompatible public final class MinimalIterable<E>
An implementation of Iterable
which throws an exception on all
invocations of the iterator()
method after the first, and whose
iterator is always unmodifiable.
The Iterable
specification does not make it absolutely clear what
should happen on a second invocation, so implementors have made various
choices, including:
Collection
implementations have, of returning a new, independent iterator
iterator
method only once, and should be tested using this
class. Exceptions to this rule should be clearly documented.
Note that although your APIs should be liberal in what they accept, your methods which return iterables should make every attempt to return ones of the robust variety.
This testing utility is not thread-safe.
Method Summary | ||
---|---|---|
static
|
from(Collection<E> elements)
Returns an iterable whose iterator returns the given elements in order. |
|
Iterator<E> |
iterator()
|
|
static
|
of(E... elements)
Returns an iterable whose iterator returns the given elements in order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <E> MinimalIterable<E> of(E... elements)
public static <E> MinimalIterable<E> from(Collection<E> elements)
public Iterator<E> iterator()
iterator
in interface Iterable<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |