public class Iterables extends Object
null.| Modifier and Type | Method and Description |
|---|---|
static <T> Iterable<T> |
filteringIterable(Iterable<? extends T> iterable,
Predicate<? super T> predicate)
Returns an iterable that provides an iterator that only returns the
elements provided by the iterator of the given iterable to which
the given predicate applies.
|
static <T> boolean |
isSorted(Iterable<? extends T> iterable,
Comparator<? super T> comparator)
Returns whether the given iterable is sorted according to the given
comparator.
|
static <T> Iterable<T> |
iterableOverIterables(Iterable<? extends Iterable<? extends T>> iterablesIterable)
Returns an iterator that combines the iterators that are provided
by the iterables that are provided by the iterator of the given
iterable.
|
static <T,C extends Collection<? super T>> |
toCollection(Iterable<T> iterable,
C collection)
Drains all elements that are provided by the iterator of
the given iterable into the given collection
|
static <T> List<T> |
toList(Iterable<T> iterable)
Drains all elements that are provided by the iterator of
the given iterable into a list
|
static <T> Set<T> |
toSet(Iterable<T> iterable)
Drains all elements that are provided by the iterator of
the given iterable into a set
|
static <S,T> Iterable<T> |
transformingIterable(Iterable<? extends S> iterable,
Function<S,? extends T> function)
Returns an iterable that provides iterators that are transforming
the elements provided by the iterators of the given iterable using
the given function
|
public static <T> List<T> toList(Iterable<T> iterable)
T - The element typeiterable - The iterablepublic static <T> Set<T> toSet(Iterable<T> iterable)
T - The element typeiterable - The iterablepublic static <T,C extends Collection<? super T>> C toCollection(Iterable<T> iterable, C collection)
T - The element typeC - The collection typeiterable - The iterablecollection - The target collectionpublic static <T> Iterable<T> iterableOverIterables(Iterable<? extends Iterable<? extends T>> iterablesIterable)
T - The element typeiterablesIterable - The iterable over the iterables. May not
provide null iterables.public static <S,T> Iterable<T> transformingIterable(Iterable<? extends S> iterable, Function<S,? extends T> function)
S - The element typeT - The value typeiterable - The delegate iterablefunction - The functionpublic static <T> Iterable<T> filteringIterable(Iterable<? extends T> iterable, Predicate<? super T> predicate)
T - The element typeiterable - The delegate iterablepredicate - The predicatepublic static <T> boolean isSorted(Iterable<? extends T> iterable, Comparator<? super T> comparator)
true if the sequence is empty.T - The element typeiterable - The iterablecomparator - The comparatorCopyright © 2020. All rights reserved.