org.qi4j.functional

## Class Iterables

- java.lang.Object
- - org.qi4j.functional.Iterables

-     public final class Iterables
      extends Object

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

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T,C extends Collection<T>> C` | `addAll(C collection, Iterable<? extends T> iterable)`
    `static <T> Iterable<T>` | `append(T item, Iterable<T> iterable)`
    `static <T> Iterable<T>` | `cache(Iterable<T> iterable)`
    `static <FROM,TO> Function<FROM,TO>` | `cast()`
    `static <T> Iterable<T>` | `cast(Iterable<?> iterable)`
    `static <T> Iterable<T>` | `constant(T item)`
    `static long` | `count(Iterable<?> iterable)`
    `static <T> Iterable<T>` | `debug(String format, Iterable<T> iterable, Function<T,String>... functions)`
    `static <T> Iterable<T>` | `empty()`
    `static <X> Iterable<X>` | `filter(Specification<?> specification, Iterable<X> i)`
    `static <X> X` | `first(Iterable<X> i)`
    `static <X> Iterable<X>` | `flatten(Iterable<?>... multiIterator)`
    `static <X,I extends Iterable<? extends X>> Iterable<X>` | `flattenIterables(Iterable<I> multiIterator)`
    `static <FROM,TO> TO` | `fold(Function<? super FROM,TO> function, Iterable<? extends FROM> i)`
    `static <T> Iterable<T>` | `iterable(Enumeration<T> enumeration)`
    `static <T> Iterable<T>` | `iterable(T... items)`
    `static <X> X` | `last(Iterable<X> i)`
    `static <T> Iterable<T>` | `limit(int limitItems, Iterable<T> iterable)`
    `static <FROM,TO> Iterable<TO>` | `map(Function<?,TO> function, Iterable<FROM> from)`
    `static <T> boolean` | `matchesAll(Specification<? super T> specification, Iterable<T> iterable)`
    `static <T> boolean` | `matchesAny(Specification<? super T> specification, Iterable<T> iterable)`
    `static <T> Iterable<T>` | `mix(Iterable<T>... iterables)`
    `static <T> Iterable<T>` | `prepend(T item, Iterable<T> iterable)`
    `static <X> Iterable<X>` | `reverse(Iterable<X> iterable)`
    `static <X> X` | `single(Iterable<X> i)`
    `static <X> Iterable<X>` | `skip(int skip, Iterable<X> iterable)`
    `static <X> Iterable<X>` | `sort(Comparator<? super X> comparator, Iterable<X> iterable)`
    `static <X extends Comparable> Iterable<X>` | `sort(Iterable<X> iterable)`
    `static <T> T[]` | `toArray(Class<T> componentType, Iterable<T> iterable)`
    `static Object[]` | `toArray(Iterable<Object> iterable)`
    `static <T> List<T>` | `toList(Iterable<T> iterable)`
    `static <T> String` | `toString(Iterable<T> iterable)`
    `static <T> String` | `toString(Iterable<T> iterable, Function<T,String> toStringFunction, String separator)`
    `static <T> Iterable<T>` | `unique(Iterable<T> iterable)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### empty

          public static <T> Iterable<T> empty()

    - #### constant

          public static <T> Iterable<T> constant(T item)

    - #### limit

          public static <T> Iterable<T> limit(int limitItems,
                              Iterable<T> iterable)

    - #### unique

          public static <T> Iterable<T> unique(Iterable<T> iterable)

    - #### 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<?> specification,
                               Iterable<X> i)

    - #### first

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

    - #### single

          public static <X> X single(Iterable<X> i)

    - #### skip

          public static <X> Iterable<X> skip(int skip,
                             Iterable<X> iterable)

    - #### last

          public static <X> X last(Iterable<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)

    - #### matchesAll

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

    - #### flatten

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

    - #### flattenIterables

          public static <X,I extends Iterable<? extends X>> Iterable<X> flattenIterables(Iterable<I> multiIterator)

    - #### mix

          @SafeVarargs
          public static <T> Iterable<T> mix(Iterable<T>... iterables)

    - #### map

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

    - #### iterable

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

    - #### iterable

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

    - #### cast

          public static <T> Iterable<T> cast(Iterable<?> iterable)

    - #### cast

          public static <FROM,TO> Function<FROM,TO> cast()

    - #### fold

          public static <FROM,TO> TO fold(Function<? super FROM,TO> function,
                          Iterable<? extends FROM> i)

    - #### prepend

          public static <T> Iterable<T> prepend(T item,
                                Iterable<T> iterable)

    - #### append

          public static <T> Iterable<T> append(T item,
                               Iterable<T> iterable)

    - #### debug

          @SafeVarargs
          public static <T> Iterable<T> debug(String format,
                                          Iterable<T> iterable,
                                          Function<T,String>... functions)

    - #### cache

          public static <T> Iterable<T> cache(Iterable<T> iterable)

    - #### toString

          public static <T> String toString(Iterable<T> iterable)

    - #### toString

          public static <T> String toString(Iterable<T> iterable,
                            Function<T,String> toStringFunction,
                            String separator)

    - #### toList

          public static <T> List<T> toList(Iterable<T> iterable)

    - #### toArray

          public static Object[] toArray(Iterable<Object> iterable)

    - #### toArray

          public static <T> T[] toArray(Class<T> componentType,
                        Iterable<T> iterable)

    - #### sort

          public static <X extends Comparable> Iterable<X> sort(Iterable<X> iterable)

    - #### sort

          public static <X> Iterable<X> sort(Comparator<? super X> comparator,
                             Iterable<X> iterable)