public class Iterables
extends java.lang.Object
Iterables.| Modifier and Type | Method | Description |
|---|---|---|
static <E> java.lang.Iterable<E> |
emptyToNull(java.lang.Iterable<E> iterable) |
Returns the given iterable if it is non-empty,
null otherwise. |
static boolean |
isNullOrEmpty(java.lang.Iterable<?> iterable) |
Checks whether the given iterable is
null or empty. |
static <E> java.lang.Iterable<E> |
nullToEmpty(java.lang.Iterable<E> iterable) |
Returns the given iterable if it is non-empty, empty iterable otherwise.
|
static <E> java.util.stream.Stream<E> |
parallelStream(java.lang.Iterable<E> iterable) |
Returns a parallel
Stream over the elements of the given iterable. |
static <E> java.util.stream.Stream<E> |
stream(java.lang.Iterable<E> iterable) |
Returns a sequential
Stream over the elements of the given iterable. |
static <E> java.util.List<E> |
toList(java.lang.Iterable<E> elements) |
Returns the given iterable converted to a
List. |
static <E> java.util.NavigableSet<E> |
toNavigableSet(java.lang.Iterable<E> elements) |
Returns the given iterable converted to a
NavigableSet. |
static <E> java.util.Set<E> |
toSet(java.lang.Iterable<E> elements) |
Returns the given iterable converted to a
Set. |
public static <E> java.lang.Iterable<E> emptyToNull(java.lang.Iterable<E> iterable)
null otherwise.public static boolean isNullOrEmpty(java.lang.Iterable<?> iterable)
null or empty.public static <E> java.lang.Iterable<E> nullToEmpty(java.lang.Iterable<E> iterable)
public static <E> java.util.stream.Stream<E> parallelStream(java.lang.Iterable<E> iterable)
Stream over the elements of the given iterable.java.lang.IllegalArgumentException - if iterable is nullpublic static <E> java.util.stream.Stream<E> stream(java.lang.Iterable<E> iterable)
Stream over the elements of the given iterable.java.lang.IllegalArgumentException - if iterable is nullpublic static <E> java.util.List<E> toList(java.lang.Iterable<E> elements)
List.java.lang.IllegalArgumentException - if elements are nullpublic static <E> java.util.NavigableSet<E> toNavigableSet(java.lang.Iterable<E> elements)
NavigableSet.java.lang.IllegalArgumentException - if elements are nullpublic static <E> java.util.Set<E> toSet(java.lang.Iterable<E> elements)
Set.java.lang.IllegalArgumentException - if elements are null