|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.inject.internal.util.Iterables
public final class Iterables
This class contains static utility methods that operate on or return objects
of type Iterable
. Also see the parallel implementations in Iterators
.
Method Summary | ||
---|---|---|
static
|
concat(Iterable<? extends Iterable<? extends T>> inputs)
Combines multiple iterables into a single iterable. |
|
static
|
concat(Iterable<? extends T> a,
Iterable<? extends T> b)
Combines two iterables into a single iterable. |
|
static
|
getOnlyElement(Iterable<T> iterable)
Returns the single element contained in iterable . |
|
static String |
toString(Iterable<?> iterable)
Returns a string representation of iterable , with the format
[e1, e2, ..., en] . |
|
static
|
transform(Iterable<F> fromIterable,
Function<? super F,? extends T> function)
Returns an iterable that applies function to each element of fromIterable . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String toString(Iterable<?> iterable)
iterable
, with the format
[e1, e2, ..., en]
.
public static <T> T getOnlyElement(Iterable<T> iterable)
iterable
.
NoSuchElementException
- if the iterable is empty
IllegalArgumentException
- if the iterable contains multiple
elementspublic static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b)
a
, followed by the elements
in b
. The source iterators are not polled until necessary.
The returned iterable's iterator supports remove()
when the
corresponding input iterator supports it.
public static <T> Iterable<T> concat(Iterable<? extends Iterable<? extends T>> inputs)
inputs
. The input iterators are not polled until necessary.
The returned iterable's iterator supports remove()
when the
corresponding input iterator supports it. The methods of the returned
iterable may throw NullPointerException
if any of the input
iterators are null.
public static <F,T> Iterable<T> transform(Iterable<F> fromIterable, Function<? super F,? extends T> function)
function
to each element of fromIterable
.
The returned iterable's iterator supports remove()
if the
provided iterator does. After a successful remove()
call,
fromIterable
no longer contains the corresponding element.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |