org.qi4j.api.util
Class Iterables

java.lang.Object
  extended by org.qi4j.api.util.Iterables

public class Iterables
extends Object

Utility methods for working with Iterables. See test for examples of how to use.


Constructor Summary
Iterables()
           
 
Method Summary
static
<T,C extends Collection<T>>
C
addAll(C collection, Iterable<? extends T> iterable)
           
static long count(Iterable<?> iterable)
           
static
<X> Iterable<X>
filter(Specification<? super X> specification, Iterable<X> i)
           
static
<X> X
first(Iterable<? extends X> i)
           
static
<X> Iterable<X>
flatten(Iterable<Iterable<X>> multiIterator)
           
static
<X> Iterable<X>
flatten(Iterable<X>... multiIterator)
           
static
<T> Iterable<T>
iterable(Enumeration<T> enumeration)
           
static
<T> Iterable<T>
iterable(T... items)
           
static
<X> X
last(Iterable<? extends X> i)
           
static
<FROM,TO> Iterable<TO>
map(Function<? super FROM,TO> function, Iterable<FROM> from)
           
static
<T> boolean
matchesAny(Specification<? super T> specification, Iterable<T> iterable)
           
static
<X> Iterable<X>
reverse(Iterable<X> iterable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Iterables

public Iterables()
Method Detail

addAll

public static <T,C extends Collection<T>> C addAll(C collection,
                                                   Iterable<? extends T> iterable)

count

public static long count(Iterable<?> iterable)

filter

public static <X> Iterable<X> filter(Specification<? super X> specification,
                                     Iterable<X> i)

first

public static <X> X first(Iterable<? extends X> i)

last

public static <X> X last(Iterable<? extends X> i)

reverse

public static <X> Iterable<X> reverse(Iterable<X> iterable)

matchesAny

public static <T> boolean matchesAny(Specification<? super T> specification,
                                     Iterable<T> iterable)

flatten

public static <X> Iterable<X> flatten(Iterable<X>... multiIterator)

flatten

public static <X> Iterable<X> flatten(Iterable<Iterable<X>> multiIterator)

map

public static <FROM,TO> Iterable<TO> map(Function<? super FROM,TO> function,
                                         Iterable<FROM> from)

iterable

public static <T> Iterable<T> iterable(Enumeration<T> enumeration)

iterable

public static <T> Iterable<T> iterable(T... items)