@ParametersAreNonnullByDefault public final class MoreIterables extends Object
Iterable instances.| Modifier and Type | Method and Description |
|---|---|
static <E> Optional<E> |
firstElement(Iterable<E> iterable)
Returns the first element contained in
iterable. |
static boolean |
isEmpty(Iterable<?> iterable)
Determines if the given
iterable contains no element. |
static boolean |
notEmpty(Iterable<?> iterable)
Determines if the given
iterable contains at least one element. |
static <E> Optional<E> |
onlyElement(Iterable<E> iterable)
Returns the single element contained in
iterable. |
static <E> Stream<E> |
parallelStream(Iterable<E> iterable)
Returns a parallel
Stream of the contents of iterable. |
static <E> Stream<E> |
stream(Iterable<E> iterable)
Returns a sequential
Stream of the contents of iterable. |
@Nonnull public static <E> Stream<E> stream(@Nullable Iterable<E> iterable)
Stream of the contents of iterable.iterable - the iterableStream of the contents of iterable@Nonnull public static <E> Stream<E> parallelStream(@Nullable Iterable<E> iterable)
Stream of the contents of iterable.iterable - the iterableStream of the contents of iterablepublic static boolean isEmpty(Iterable<?> iterable)
iterable contains no element.iterable - the iterabletrue if the iterable contains no elementpublic static boolean notEmpty(Iterable<?> iterable)
iterable contains at least one element.iterable - the iterabletrue if the iterable contains at least one element@Nonnull public static <E> Optional<E> onlyElement(Iterable<E> iterable)
iterable.iterable - the iterableOptional containing the single element of the iterable, or Optional.empty() if
the iterable is empty.IllegalArgumentException - if the iterable contains more than one element@Nonnull public static <E> Optional<E> firstElement(Iterable<E> iterable)
iterable.iterable - the iterableOptional containing the first element of the iterable, or Optional.empty() if
the iterable is empty.IllegalArgumentException - if the iterable contains more than one elementCopyright © 2017–2019 Atlanmod. All rights reserved.