|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.molindo.utils.collections.IteratorUtils
public class IteratorUtils
| Field Summary | |
|---|---|
static Iterable<?> |
EMPTY_ITERABLE
|
static Iterator<?> |
EMPTY_ITERATOR
|
| Method Summary | ||
|---|---|---|
static
|
addAll(C collection,
Iterator<T> iter)
adds all elements from iter to collection |
|
static
|
cast(Class<T> cls,
Iterable<?> iterable)
a type safe cast for Iterable |
|
static
|
cast(Class<T> cls,
Object[] list)
type safe cast from any array to an Iterable |
|
static
|
empty()
type save access to EMPTY_ITERATOR |
|
static
|
emptyIterable()
type save access to EMPTY_ITERABLE |
|
static boolean |
equals(Iterable<?> iterable1,
Iterable<?> iterable2)
|
|
static boolean |
equals(Iterator<?> iter1,
Iterator<?> iter2)
|
|
static
|
filter(Iterable<T> iterable,
Function<T,Boolean> filter)
|
|
static
|
filter(Iterator<T> iter,
Function<T,Boolean> filter)
|
|
static
|
first(Iterable<T> iter)
|
|
static
|
iterable(Iterator<T> iter)
|
|
static
|
iterator(Iterable<T> iterable)
|
|
static
|
iterators(Iterable<? extends Iterable<T>> iterables)
transforms an Iterable of Iterables to an
Iterable of Iterators |
|
static
|
iterators(Iterator<? extends Iterable<T>> iterables)
transforms an Iterator of Iterables to an
Iterator of Iterators |
|
static
|
list(Iterable<T> iter)
|
|
static
|
list(Iterable<T> iter,
int initialCapacity)
|
|
static
|
list(Iterator<T> iter)
|
|
static
|
list(Iterator<T> iter,
int initialCapacity)
|
|
static
|
max(Iterator<T> iter,
int max)
don't return more elements than given by max |
|
static
|
next(Iterator<T> iter)
|
|
static
|
notNull(Iterable<T> iter)
|
|
static
|
notNull(Iterator<T> iter)
|
|
static
|
object(T o)
|
|
static
|
readOnly(Iterable<T> iter)
|
|
static
|
readOnly(Iterator<T> iter)
|
|
static
|
skip(Iterator<T> iter,
int skip)
skips a given number of elements in iterator while there are available |
|
static
|
transform(Iterable<? extends F> iterable,
Function<F,T> f)
|
|
static
|
transform(Iterator<? extends F> iter,
Function<F,T> f)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Iterator<?> EMPTY_ITERATOR
public static final Iterable<?> EMPTY_ITERABLE
| Method Detail |
|---|
public static <T> Iterable<T> iterable(Iterator<T> iter)
T - iter -
Iterable that alway returns the passed
Iterator instancepublic static <T> Iterator<T> iterator(Iterable<T> iterable)
T - iterable -
Iterable.iterator() or EMPTY_ITERATOR if nullpublic static <T> Iterator<Iterator<T>> iterators(Iterator<? extends Iterable<T>> iterables)
Iterator of Iterables to an
Iterator of Iterators
public static <T> Iterable<Iterator<T>> iterators(Iterable<? extends Iterable<T>> iterables)
Iterable of Iterables to an
Iterable of Iterators
public static <T> T next(Iterator<T> iter)
T - iter -
null otherwisepublic static <T> T first(Iterable<T> iter)
T - iter -
null otherwisepublic static <T> ArrayList<T> list(Iterable<T> iter)
T - iter -
ArrayList containing all elements
public static <T> ArrayList<T> list(Iterable<T> iter,
int initialCapacity)
T - iter -
ArrayList containing all elementspublic static <T> ArrayList<T> list(Iterator<T> iter)
T - iter -
ArrayList containing all elements
public static <T> ArrayList<T> list(Iterator<T> iter,
int initialCapacity)
T - iter -
ArrayList containing all elements
public static <T,C extends Collection<T>> C addAll(C collection,
Iterator<T> iter)
T - C - collection - iter -
public static <T> Iterator<T> empty()
EMPTY_ITERATOR
T -
public static <T> Iterable<T> emptyIterable()
EMPTY_ITERABLE
T -
public static <T> Iterator<T> notNull(Iterator<T> iter)
public static <T> Iterable<T> notNull(Iterable<T> iter)
public static <T> Iterable<T> cast(Class<T> cls,
Object[] list)
Iterable
T - cls - list -
public static <T> Iterable<T> cast(Class<T> cls,
Iterable<?> iterable)
Iterable
T - cls - iterable -
public static <T> Iterator<T> skip(Iterator<T> iter,
int skip)
T - iter - skip -
public static <T> Iterator<T> max(Iterator<T> iter,
int max)
T - iter - max -
public static <T> Iterator<T> object(T o)
public static <T> Iterable<T> filter(Iterable<T> iterable,
Function<T,Boolean> filter)
public static <T> Iterator<T> filter(Iterator<T> iter,
Function<T,Boolean> filter)
T - iter - filter - function that returns true if object is allowed
public static <F,T> Iterator<T> transform(Iterator<? extends F> iter,
Function<F,T> f)
public static <F,T> Iterable<T> transform(Iterable<? extends F> iterable,
Function<F,T> f)
public static boolean equals(Iterable<?> iterable1,
Iterable<?> iterable2)
public static boolean equals(Iterator<?> iter1,
Iterator<?> iter2)
public static <T> Iterable<T> readOnly(@Nonnull
Iterable<T> iter)
public static <T> Iterator<T> readOnly(@Nonnull
Iterator<T> iter)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||