| Modifier and Type | Field and Description |
|---|---|
static Iterable |
EMPTY_ITERABLE
The empty
Iterable. |
| Modifier and Type | Method and Description |
|---|---|
static <T> Iterable<T> |
concat(Iterable<? extends Iterable<? extends T>> iterables)
Concatenates the given
Iterables into a single one. |
static <T> Iterable<T> |
concat(Iterable<? extends T>... iterables)
Concatenates the given
Iterables into a single one. |
static <T> Iterable<T> |
cycle(Iterable<? extends T> iterable)
Returns a cyclic
Iterable that cycles indefinitely over the
given Iterable's elements. |
static <T> Iterable<T> |
cycle(T... elements)
Returns an
Iterable that cycles indefinitely over the given
elements. |
static <T> Iterable<T> |
emptyIterable()
Returns the empty
Iterable for a particular type (type-safe). |
static boolean |
equal(Iterable<?> i1,
Iterable<?> i2)
Returns whether the given
Iterables contain equal elements in
the same order. |
static <T> Iterable<T> |
limit(Iterable<? extends T> iterable,
int limit)
Returns an
Iterable view of the given Iterable that
will only return its first limit items. |
static <T> Iterable<T> |
skip(Iterable<T> iterable,
int n)
Returns an
Iterable view of the given Iterable that
skips its first n elements. |
static <T> Bag<T> |
toBag(Iterable<? extends T> iterable)
Returns a
Bag containing all the given Iterable's
elements. |
static <T> List<T> |
toList(Iterable<? extends T> iterable)
Returns a
List containing all the given Iterable's
elements. |
static <T> Set<T> |
toSet(Iterable<? extends T> iterable)
Returns a
Set containing all the given Iterable's
elements. |
static String |
toString(Iterable<?> iterable)
Returns a
String representation of the given Iterable
using the "[e1, e2, ..., en]" format. |
public static final Iterable EMPTY_ITERABLE
Iterable.public static <T> Iterable<T> emptyIterable()
Iterable for a particular type (type-safe).
Note that unlike this method, the like-named static field does not
provide type safety.T - the type of the Iterable's elements.Iterable.public static <T> Iterable<T> concat(Iterable<? extends T>... iterables)
Iterables into a single one. Note that
the returned Iterable is only a view, that is, any subsequent
update on any of the input Iterables will affect the returned
view. The input Iterables will not be polled until necessary.
The returned view's Iterator supports Iterator.remove()
when the corresponding input Iterator supports it.T - the type of the returned Iterables' elements.iterables - the Iterables to concatenate.Iterable.NullPointerException - if iterables is null or
if it contains a null reference.public static <T> Iterable<T> concat(Iterable<? extends Iterable<? extends T>> iterables)
Iterables into a single one. Note that
the returned Iterable is only a view, that is, any subsequent
update on any of the input Iterables will affect the returned
view. The input Iterables will not be polled until necessary.
The returned view's Iterator supports Iterator.remove()
when the corresponding input Iterator supports it.T - the type of the returned Iterables' elements.iterables - the Iterables to concatenate.Iterable.NullPointerException - if iterables is null or
if it contains a null reference.public static <T> Iterable<T> cycle(Iterable<? extends T> iterable)
Iterable that cycles indefinitely over the
given Iterable's elements. The returned Iterable's
Iterator supports Iterator#remove().T - the type of the returned Iterable's elements.iterable - the Iterable containing the elements to
cycle over.Iterable.NullPointerException - if iterable is null.public static <T> Iterable<T> cycle(T... elements)
Iterable that cycles indefinitely over the given
elements. The returned Iterable's Iterator supports
Iterator.remove().T - the type of the returned Iterable's elements.elements - the elements to cycle over.Iterable.NullPointerException - if iterable is null.public static boolean equal(Iterable<?> i1, Iterable<?> i2)
Iterables contain equal elements in
the same order.i1 - the first Iterable.i2 - the second Iterable.Iterables have the same content.public static <T> Iterable<T> limit(Iterable<? extends T> iterable, int limit)
Iterable view of the given Iterable that
will only return its first limit items. The returned view's
Iterators support Iterator.remove() if the original
Iterator does.T - the type of the returned Iterable's elements.iterable - the Iterable to limit.limit - the number of elements in the returned Iterable.Iterable.NullPointerException - if iterable is null.IllegalArgumentException - if (limit is negative.public static <T> Iterable<T> skip(Iterable<T> iterable, int n)
Iterable view of the given Iterable that
skips its first n elements. The returned Iterable's
Iterator supports Iterator.remove() if the original
Iterator does.T - the type of the Iterable's elements.iterable - the input Iterable.n - the number of items to skip.Iterable.NullPointerException - if iterable is null.IllegalArgumentException - if (n is negative.public static <T> List<T> toList(Iterable<? extends T> iterable)
List containing all the given Iterable's
elements.T - the type of the returned List's elements.iterable - the source Iterable.List created from the given Iterable.NullPointerException - if iterable is null.public static <T> Set<T> toSet(Iterable<? extends T> iterable)
Set containing all the given Iterable's
elements. The returned Set has the same iteration order as
the source Iterable.T - the type of the returned Set's elements.iterable - the source Iterable.Set created from the given Iterable.NullPointerException - if iterable is null.public static <T> Bag<T> toBag(Iterable<? extends T> iterable)
Bag containing all the given Iterable's
elements. The returned Bag has the same iteration order as
the source Iterable.T - the type of the returned Bag's elements.iterable - the source Iterable.Bag created from the given Iterable.NullPointerException - if iterable is null.public static String toString(Iterable<?> iterable)
String representation of the given Iterable
using the "[e1, e2, ..., en]" format.iterable - the Iterable.String created from the given Iterable.NullPointerException - if iterable is null.Copyright © 2012–2015. All rights reserved.