public final class Iterables
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
asArray(java.lang.Iterable<T> iterable)
Converts an
Iterable to an Array |
static <T> java.util.List<T> |
asList(java.lang.Iterable<T> iterable)
Converts an
Iterable to a List |
static <T> java.util.Set<T> |
asSet(java.lang.Iterable<T> iterable)
Converts an
Iterable to a Set |
static <T> java.lang.Iterable<T> |
empty()
Creates a new empty
Iterable of T |
static <T> T |
first(java.lang.Iterable<T> iterable)
Returns the first element of an
Iterable |
static <T> boolean |
isEmpty(java.lang.Iterable<T> iterable)
Checks if an
Iterable is empty |
static <T> java.lang.Iterable<T> |
of(java.lang.Iterable<T> iterable)
Returns a lazy
Iterable from another Iterable. |
static <T> java.lang.Iterable<T> |
of(T[] array)
Returns a lazy
Iterable from an Array. |
static <T> int |
size(java.lang.Iterable<T> iterable)
Calculates the length/size of an
Iterable |
public static <T> java.util.List<T> asList(java.lang.Iterable<T> iterable)
Iterable to a Listiterable - an Iterablejava.lang.NullPointerException - if iterable is nullpublic static <T> java.util.Set<T> asSet(java.lang.Iterable<T> iterable)
Iterable to a Setiterable - an Iterablejava.lang.NullPointerException - if iterable is nullpublic static <T> T[] asArray(java.lang.Iterable<T> iterable)
Iterable to an Arrayiterable - an Iterablejava.lang.NullPointerException - if iterable is nullpublic static <T> boolean isEmpty(java.lang.Iterable<T> iterable)
Iterable is emptyiterable - an Iterablejava.lang.NullPointerException - if iterable is nullpublic static <T> java.lang.Iterable<T> empty()
Iterable of Tpublic static <T> int size(java.lang.Iterable<T> iterable)
Iterableiterable - an Iterablejava.lang.NullPointerException - if iterable is nullpublic static <T> T first(java.lang.Iterable<T> iterable)
Iterableiterable - java.lang.NullPointerException - if iterable is nullpublic static <T> java.lang.Iterable<T> of(java.lang.Iterable<T> iterable)
Iterable from another Iterable.
Iterator.remove() throws an UnsupportedOperationException.iterable - an Iterablejava.lang.NullPointerException - if iterable is nullpublic static <T> java.lang.Iterable<T> of(T[] array)
Iterable from an Array.
Iterator.remove() throws an UnsupportedOperationException.array - an Arrayjava.lang.NullPointerException - if array is null