|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.util.Iterables
public class Iterables
Facade for the Iterators in this package, supporting the new forloop syntax. Only iterators that perform their service during the hasNext()/next() sequence are given in this facade. Iterators that augment to the basic Iterator interface, (e.g., CachingIterator) are not included.
Copyright © 2004 David A. Hall
Constructor Summary | |
---|---|
Iterables()
|
Method Summary | ||
---|---|---|
static
|
addAll(java.util.Collection<? super T> c,
java.lang.Iterable<T> iter)
Adds all of the elements of the iterable to the collection. |
|
static
|
addAll(java.util.Collection<? super T> c,
T[] ts)
Adds all of the elements of the array to the collection. |
|
static
|
filter(java.lang.Iterable<? extends T> i,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns only elements for which the predicate is true |
|
static
|
filter(T[] ts,
UnaryFunctor<T,java.lang.Boolean> pred)
Returns only elements for which the predicate is true |
|
static
|
findAll(java.lang.Iterable<? extends T> i,
UnaryFunctor<java.util.Iterator<? extends T>,? extends java.util.Iterator<T>> fn)
Returns iterators that point to the next instance in an iterable that meets the condition described in the functor. |
|
static
|
findAll(T[] ts,
UnaryFunctor<java.util.Iterator<? extends T>,? extends java.util.Iterator<T>> fn)
Returns iterators that point to the next instance in an iterable that meets the condition described in the functor. |
|
static
|
merge(java.lang.Iterable<? extends T> i1,
java.lang.Iterable<? extends T> i2)
Returns all elements of both iterables, always choosing the lesser of the two current elements. |
|
static
|
merge(java.lang.Iterable<? extends T> i1,
java.lang.Iterable<? extends T> i2,
BinaryFunctor<T,T,java.lang.Boolean> fn)
Returns all elements of both iterables, using the given predicate to choose which element to return. |
|
static
|
merge(java.lang.Iterable<? extends T> i1,
java.lang.Iterable<? extends T> i2,
java.util.Comparator<T> comp)
Returns all elements of both iterables, always choosing the lesser of the two current elements. |
|
static
|
merge(T[] ts1,
T[] ts2)
Returns all elements of both arrays, always choosing the lesser of the two current elements. |
|
static
|
merge(T[] ts1,
T[] ts2,
BinaryFunctor<T,T,java.lang.Boolean> fn)
Returns all elements of both arrays, using the given predicate to choose which element to return. |
|
static
|
merge(T[] ts1,
T[] ts2,
java.util.Comparator<T> comp)
Returns all elements of both arrays, always choosing the lesser of the two current elements. |
|
static
|
transform(java.lang.Iterable<? extends T> i,
BinaryFunctor<T,T,R> fn)
Returns the results of applying the given functor to succesive pairs of elements. |
|
static
|
transform(java.lang.Iterable<? extends T> i,
UnaryFunctor<T,R> fn)
Returns the results of applying the given functor to each element in turn. |
|
static
|
transform(java.lang.Iterable<? extends T1> i1,
java.lang.Iterable<? extends T2> i2,
BinaryFunctor<T1,T2,R> fn)
Returns the results of applying the given functor to corresponding elements. |
|
static
|
transform(T[] ts,
BinaryFunctor<T,T,R> fn)
Returns the results of applying the given functor to succesive pairs of elements. |
|
static
|
transform(T[] ts,
UnaryFunctor<T,R> fn)
Returns the results of applying the given functor to each element in turn. |
|
static
|
transform(T1[] ts1,
T2[] ts2,
BinaryFunctor<T1,T2,R> fn)
Returns the results of applying the given functor to corresponding elements. |
|
static
|
unique(java.lang.Iterable<? extends T> i)
Returns unduplicated results: will not return the same value twice in succession. |
|
static
|
unique(java.lang.Iterable<? extends T> i,
BinaryFunctor<T,T,java.lang.Boolean> eq)
Returns unduplicated results: will not return the same value twice in succession, as determined by the given predicate. |
|
static
|
unique(T[] ts)
Returns unduplicated results: will not return the same value twice in succession. |
|
static
|
unique(T[] ts,
BinaryFunctor<T,T,java.lang.Boolean> eq)
Returns unduplicated results: will not return the same value twice in succession, as determined by the given predicate. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Iterables()
Method Detail |
---|
public static <T> java.lang.Iterable<java.util.Iterator<? extends T>> findAll(java.lang.Iterable<? extends T> i, UnaryFunctor<java.util.Iterator<? extends T>,? extends java.util.Iterator<T>> fn)
public static <T> java.lang.Iterable<java.util.Iterator<? extends T>> findAll(T[] ts, UnaryFunctor<java.util.Iterator<? extends T>,? extends java.util.Iterator<T>> fn)
public static <T> java.lang.Iterable<T> filter(java.lang.Iterable<? extends T> i, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T> java.lang.Iterable<T> filter(T[] ts, UnaryFunctor<T,java.lang.Boolean> pred)
public static <T extends java.lang.Comparable<T>> java.lang.Iterable<T> merge(java.lang.Iterable<? extends T> i1, java.lang.Iterable<? extends T> i2)
public static <T extends java.lang.Comparable<T>> java.lang.Iterable<T> merge(T[] ts1, T[] ts2)
public static <T> java.lang.Iterable<T> merge(java.lang.Iterable<? extends T> i1, java.lang.Iterable<? extends T> i2, java.util.Comparator<T> comp)
public static <T> java.lang.Iterable<T> merge(T[] ts1, T[] ts2, java.util.Comparator<T> comp)
public static <T> java.lang.Iterable<T> merge(java.lang.Iterable<? extends T> i1, java.lang.Iterable<? extends T> i2, BinaryFunctor<T,T,java.lang.Boolean> fn)
public static <T> java.lang.Iterable<T> merge(T[] ts1, T[] ts2, BinaryFunctor<T,T,java.lang.Boolean> fn)
public static <T,R> java.lang.Iterable<R> transform(java.lang.Iterable<? extends T> i, UnaryFunctor<T,R> fn)
public static <T,R> java.lang.Iterable<R> transform(T[] ts, UnaryFunctor<T,R> fn)
public static <T1,T2,R> java.lang.Iterable<R> transform(java.lang.Iterable<? extends T1> i1, java.lang.Iterable<? extends T2> i2, BinaryFunctor<T1,T2,R> fn)
public static <T1,T2,R> java.lang.Iterable<R> transform(T1[] ts1, T2[] ts2, BinaryFunctor<T1,T2,R> fn)
public static <T,R> java.lang.Iterable<R> transform(java.lang.Iterable<? extends T> i, BinaryFunctor<T,T,R> fn)
public static <T,R> java.lang.Iterable<R> transform(T[] ts, BinaryFunctor<T,T,R> fn)
public static <T> java.lang.Iterable<T> unique(java.lang.Iterable<? extends T> i)
public static <T> java.lang.Iterable<T> unique(T[] ts)
public static <T> java.lang.Iterable<T> unique(java.lang.Iterable<? extends T> i, BinaryFunctor<T,T,java.lang.Boolean> eq)
public static <T> java.lang.Iterable<T> unique(T[] ts, BinaryFunctor<T,T,java.lang.Boolean> eq)
public static <T> boolean addAll(java.util.Collection<? super T> c, java.lang.Iterable<T> iter)
public static <T> boolean addAll(java.util.Collection<? super T> c, T[] ts)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |