public class Iterators extends Object
null.| Modifier and Type | Method and Description |
|---|---|
static <T> Iterator<T> |
filteringIterator(Iterator<? extends T> iterator,
Predicate<? super T> predicate)
Creates an iterator that only returns the elements from the
given iterator to which the given predicate applies.
|
static <T> Iterator<T> |
iteratorOverIterables(Iterable<? extends T> iterable0,
Iterable<? extends T> iterable1)
Returns an iterator that combines the iterators that are
returned by the given iterables
|
static <S extends Iterable<? extends T>,T> |
iteratorOverIterables(Iterable<S> iterablesIterable)
Returns an iterator that combines the iterators that are
returned by the iterables that are provided by the iterator
that is provided by the given iterable
|
static <S extends Iterable<? extends T>,T> |
iteratorOverIterables(Iterator<S> iterablesIterator)
Returns an iterator that combines the iterators that are
returned by the iterables that are provided by the
given iterator
|
static <S extends Iterator<? extends T>,T> |
iteratorOverIterators(Iterable<S> iteratorsIterable)
Returns an iterator that combines the iterators that
are returned by the iterator that is returned by the
given iterable.
|
static <T> Iterator<T> |
iteratorOverIterators(Iterator<? extends T> iterator0,
Iterator<? extends T> iterator1)
Returns an iterator that combines the given iterators.
|
static <S extends Iterator<? extends T>,T> |
iteratorOverIterators(Iterator<S> iteratorsIterator)
Returns an iterator that combines the iterators
that are returned by the given iterator.
|
static <T,C extends Collection<? super T>> |
toCollection(Iterator<T> iterator,
C collection)
Drains all elements that are provided by the given iterator
into the given collection
|
static <T> List<T> |
toList(Iterator<T> iterator)
Drains all elements from the given iterator into a list
|
static <T> Set<T> |
toSet(Iterator<T> iterator)
Drains all elements from the given iterator into a set
|
static <S,T> Iterator<T> |
transformingIterator(Iterator<? extends S> iterator,
Function<S,? extends T> function)
Creates an iterator that passes the values that are provided
by the given delegate iterator to the given function, and
returns the resulting values
|
static <T> Iterator<T> |
weakeningIterator(Iterator<? extends T> delegate)
Returns an iterator that removes the type bound
of another iterator
|
public static <T> List<T> toList(Iterator<T> iterator)
T - The element typeiterator - The iteratorpublic static <T> Set<T> toSet(Iterator<T> iterator)
T - The element typeiterator - The iteratorpublic static <T,C extends Collection<? super T>> C toCollection(Iterator<T> iterator, C collection)
T - The element typeC - The collection typeiterator - The iteratorcollection - The target collectionpublic static <T> Iterator<T> weakeningIterator(Iterator<? extends T> delegate)
T - The element typedelegate - The delegate iteratorpublic static <T> Iterator<T> iteratorOverIterators(Iterator<? extends T> iterator0, Iterator<? extends T> iterator1)
T - The element typeiterator0 - The first iteratoriterator1 - The second iteratorpublic static <S extends Iterator<? extends T>,T> Iterator<T> iteratorOverIterators(Iterator<S> iteratorsIterator)
S - The iterator typeT - The element typeiteratorsIterator - The iterator iterator. May not provide
null iterators.public static <S extends Iterator<? extends T>,T> Iterator<T> iteratorOverIterators(Iterable<S> iteratorsIterable)
S - The iterator typeT - The element typeiteratorsIterable - The iterable for the iterators. May not
provide null iterators.public static <S extends Iterable<? extends T>,T> Iterator<T> iteratorOverIterables(Iterator<S> iterablesIterator)
S - The iterable typeT - The element typeiterablesIterator - The iterator over the iterables.
May not provide null iterablespublic static <S extends Iterable<? extends T>,T> Iterator<T> iteratorOverIterables(Iterable<S> iterablesIterable)
S - The iterable typeT - The element typeiterablesIterable - The iterable for the iterables. May not
provide null iterables.public static <T> Iterator<T> iteratorOverIterables(Iterable<? extends T> iterable0, Iterable<? extends T> iterable1)
T - The element typeiterable0 - The first iterableiterable1 - The second iterablepublic static <S,T> Iterator<T> transformingIterator(Iterator<? extends S> iterator, Function<S,? extends T> function)
S - The element typeT - The value typeiterator - The delegate iteratorfunction - The functionpublic static <T> Iterator<T> filteringIterator(Iterator<? extends T> iterator, Predicate<? super T> predicate)
T - The element typeiterator - The delegate iteratorpredicate - The predicateCopyright © 2015. All rights reserved.