Iterables (Neo4j Community 2.1.0-M01 API)
Date: 2014-02-20

org.neo4j.helpers.collection

## Class Iterables

- java.lang.Object
- - org.neo4j.helpers.collection.Iterables

-     public final class Iterables
      extends Object

  TODO: Combine this and `IteratorUtil` into one class

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Iterables()`

  - ### 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,C extends T> Iterable<T>` | `append(C item, Iterable<T> iterable)`
    `static <T> ResourceIterable<T>` | `asResourceIterable(Iterable<T> labels)`
    `static <T> ResourceIterable<T>` | `asResourceIterable(ResourceIterator<T> it)`
    `static <T> Iterable<T>` | `cache(Iterable<T> iterable)`
    `static <FROM,TO> Function<FROM,TO>` | `cast()`
    `static <T,C> Iterable<T>` | `cast(Iterable<C> iterable)`
    `static <T> Iterable<T>` | `concat(Iterable<? extends T>... iterables)`
    `static <T> Iterable<T>` | `concat(Iterable<Iterable<T>> iterables)`
    `static <T> Iterator<T>` | `concat(Iterator<? extends T>... iterables)`
    `static <T> Iterator<T>` | `concat(Iterator<Iterator<T>> iterators)`
    `static <T> ResourceIterator<T>` | `concatResourceIterators(Iterator<ResourceIterator<T>> iterators)`
    `static long` | `count(Iterable<?> iterable)`
    `static <T> Iterable<T>` | `empty()`
    `static <X> Iterable<X>` | `filter(Predicate<? super X> specification, Iterable<X> i)`
    `static <X> Iterator<X>` | `filter(Predicate<? super X> specification, Iterator<X> i)`
    `static <X> X` | `first(Iterable<? extends X> i)`
    `static <FROM,TO> Iterator<TO>` | `flatMap(Function<? super FROM,? extends Iterator<TO>> function, Iterator<FROM> from)`
    `static <X,I extends Iterable<? extends X>> Iterable<X>` | `flatten(I... multiIterator)`
    `static <T> int` | `indexOf(T itemToFind, Iterable<T> iterable)` Returns the index of the first occurrence of the specified element in this iterable, or -1 if this iterable does not contain the element.
    `static <T,C extends T> Iterable<T>` | `iterable(C... items)`
    `static String` | `join(String joinString, Iterable<?> iter)`
    `static String` | `join(String joinString, Iterator<?> iter)`
    `static <X> X` | `last(Iterable<? extends X> i)`
    `static <T> Function<Iterable<T>,Iterable<T>>` | `limit(int limitItems)`
    `static <T> Iterable<T>` | `limit(int limitItems, Iterable<T> iterable)`
    `static <FROM,TO> Iterable<TO>` | `map(Function<? super FROM,? extends TO> function, Iterable<FROM> from)`
    `static <FROM,TO> Iterator<TO>` | `map(Function<? super FROM,? extends TO> function, Iterator<FROM> from)`
    `static <T> Iterator<T>` | `map(FunctionFromPrimitiveInt<T> mapFunction, org.neo4j.kernel.impl.util.PrimitiveIntIterator source)`
    `static <T> Iterator<T>` | `map(FunctionFromPrimitiveLong<T> mapFunction, org.neo4j.kernel.impl.util.PrimitiveLongIterator source)`
    `static <T> Iterable<T>` | `mix(Iterable<T>... iterables)`
    `static <T> Iterable<T>` | `option(T item)`
    `static <T,C extends T> Iterable<T>` | `prepend(C item, Iterable<T> iterable)`
    `static <X> Iterable<X>` | `reverse(Iterable<X> iterable)`
    `static <X> X` | `single(Iterable<? extends X> i)`
    `static <X> Iterable<X>` | `skip(int skip, Iterable<X> iterable)`
    `static <T,S extends Comparable> Iterable<T>` | `sort(Iterable<T> iterable, Function<T,S> compareFunction)`
    `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> Set<T>` | `toSet(Iterable<T> iterable)`
    `static String` | `toString(Iterable<?> values, String separator)`
    `static <T> Iterable<T>` | `unique(Iterable<T> iterable)`

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

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

- - ### Constructor Detail

    - #### Iterables

          public Iterables()

  - ### Method Detail

    - #### empty

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

    - #### limit

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

    - #### limit

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

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

    - #### filter

          public static <X> Iterator<X> filter(Predicate<? super X> specification,
                               Iterator<X> i)

    - #### first

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

    - #### single

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

    - #### skip

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

    - #### last

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

    - #### reverse

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

    - #### flatten

          @SafeVarargs
          public static <X,I extends Iterable<? extends X>> Iterable<X> flatten(I... multiIterator)

    - #### mix

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

    - #### map

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

    - #### map

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

    - #### flatMap

          public static <FROM,TO> Iterator<TO> flatMap(Function<? super FROM,? extends Iterator<TO>> function,
                                       Iterator<FROM> from)

    - #### map

          public static <T> Iterator<T> map(FunctionFromPrimitiveLong<T> mapFunction,
                            org.neo4j.kernel.impl.util.PrimitiveLongIterator source)

    - #### map

          public static <T> Iterator<T> map(FunctionFromPrimitiveInt<T> mapFunction,
                            org.neo4j.kernel.impl.util.PrimitiveIntIterator source)

    - #### iterable

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

    - #### cast

          public static <T,C> Iterable<T> cast(Iterable<C> iterable)

    - #### concat

          @SafeVarargs
          public static <T> Iterable<T> concat(Iterable<? extends T>... iterables)

    - #### concat

          public static <T> Iterable<T> concat(Iterable<Iterable<T>> iterables)

    - #### concat

          @SafeVarargs
          public static <T> Iterator<T> concat(Iterator<? extends T>... iterables)

    - #### concatResourceIterators

          public static <T> ResourceIterator<T> concatResourceIterators(Iterator<ResourceIterator<T>> iterators)

    - #### concat

          public static <T> Iterator<T> concat(Iterator<Iterator<T>> iterators)

    - #### cast

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

    - #### prepend

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

    - #### append

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

    - #### cache

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

    - #### 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)

    - #### asResourceIterable

          public static <T> ResourceIterable<T> asResourceIterable(Iterable<T> labels)

    - #### asResourceIterable

          public static <T> ResourceIterable<T> asResourceIterable(ResourceIterator<T> it)

    - #### toSet

          public static <T> Set<T> toSet(Iterable<T> iterable)

    - #### toString

          public static String toString(Iterable<?> values,
                        String separator)

    - #### indexOf

          public static <T> int indexOf(T itemToFind,
                        Iterable<T> iterable)

      Returns the index of the first occurrence of the specified element in this iterable, or -1 if this iterable does not contain the element. More formally, returns the lowest index `i` such that `(o==null ? get(i)==null : o.equals(get(i)))`, or -1 if there is no such index.

    - #### option

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

    - #### sort

          public static <T,S extends Comparable> Iterable<T> sort(Iterable<T> iterable,
                                                  Function<T,S> compareFunction)

    - #### join

          public static String join(String joinString,
                    Iterable<?> iter)

    - #### join

          public static String join(String joinString,
                    Iterator<?> iter)

Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.