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

org.neo4j.helpers.collection

## Class IteratorUtil

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

-     public abstract class IteratorUtil
      extends Object

  Contains common functionality regarding `Iterator`s and `Iterable`s.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Function<Enum,String>` | `ENUM_NAME` Function for converting Enum to String

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IteratorUtil()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <C extends Collection<T>,T> C` | `addToCollection(Iterable<T> iterable, C collection)` Adds all the items in `iterator` to `collection`.
    `static <C extends Collection<T>,T> C` | `addToCollection(Iterator<T> iterator, C collection)` Adds all the items in `iterator` to `collection`.
    `static <C extends Collection<Integer>> C` | `addToCollection(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator, C collection)` Adds all the items in `iterator` to `collection`.
    `static <C extends Collection<Long>> C` | `addToCollection(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator, C collection)` Adds all the items in `iterator` to `collection`.
    `static <C extends Collection<T>,T> C` | `addToCollectionUnique(Iterable<T> iterable, C collection)` Adds all the items in `iterator` to `collection`.
    `static <C extends Collection<T>,T> C` | `addToCollectionUnique(Iterator<T> iterator, C collection)` Adds all the items in `iterator` to `collection`.
    `static <T> Collection<T>` | `asCollection(Iterable<T> iterable)` Creates a collection from an iterable.
    `static <T> Collection<T>` | `asCollection(Iterator<T> iterable)`
    `static <E extends Enum<E>> Set<String>` | `asEnumNameSet(Class<E> clazz)` Converts an enum class to to `Set` of the names of all valid enum values
    `static Set<String>` | `asEnumNameSet(Iterable<Enum> enums)` Converts an `Iterable` of enums to `Set` of their names.
    `static ClosableIterable<String>` | `asIterable(File file, String encoding)` Creates an `Iterable` for iterating over the lines of a text file.
    `static <T> Iterable<T>` | `asIterable(Iterator<T> iterator)` Exposes `iterator` as an `Iterable`.
    `static Iterable<Long>` | `asIterable(long... array)`
    `static <T> Iterable<T>` | `asIterable(T... array)`
    `static ClosableIterator<String>` | `asIterator(File file, String encoding)` Creates an `Iterator` for iterating over the lines of a text file.
    `static <T> Iterator<T>` | `asIterator(int maxItems, T... array)`
    `static Iterator<Long>` | `asIterator(long... array)`
    `static <T> List<T>` | `asList(Iterable<T> iterator)`
    `static <T> List<T>` | `asList(Iterator<T> iterator)`
    `static List<Integer>` | `asList(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator)`
    `static List<Long>` | `asList(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)`
    `static org.neo4j.kernel.impl.util.PrimitiveIntIterator` | `asPrimitiveIterator(int... array)`
    `static org.neo4j.kernel.impl.util.PrimitiveLongIterator` | `asPrimitiveIterator(long... array)`
    `static <T> ResourceIterator<T>` | `asResourceIterator(Iterator<T> iterator)`
    `static <T> Set<T>` | `asSet(Iterable<T> iterable)` Creates a `Set` from an `Iterable`.
    `static <T> Set<T>` | `asSet(Iterator<T> iterator)`
    `static Set<Integer>` | `asSet(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator)`
    `static Set<Long>` | `asSet(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)`
    `static <T> Set<T>` | `asSet(T... items)` Creates a `Set` from an array of items.
    `static <T> Set<T>` | `asUniqueSet(Iterable<T> iterable)` Creates a `Set` from an `Iterable`.
    `static <T> Set<T>` | `asUniqueSet(Iterator<T> items)` Creates a `Set` from an array of items.
    `static Set<Long>` | `asUniqueSet(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)` Creates a `Set` from an array of iterator.
    `static <T> Set<T>` | `asUniqueSet(T... items)` Creates a `Set` from an array of items.
    `static <T extends CloneableInPublic> Iterable<T>` | `cloned(Iterable<T> items, Class<T> itemClass)`
    `static <T> boolean` | `contains(Iterator<T> iterator, T item)`
    `static boolean` | `contains(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator, int item)`
    `static boolean` | `contains(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator, long item)`
    `static <T> int` | `count(Iterable<T> iterable)` Counts the number of items in the `iterable` by looping through it.
    `static <T> int` | `count(Iterator<T> iterator)` Counts the number of items in the `iterator` by looping through it.
    `static <T> ResourceIterator<T>` | `emptyIterator()`
    `static <T> List<T>` | `emptyListOf(Class<T> type)`
    `static org.neo4j.kernel.impl.util.PrimitiveIntIterator` | `emptyPrimitiveIntIterator()`
    `static org.neo4j.kernel.impl.util.PrimitiveLongIterator` | `emptyPrimitiveLongIterator()`
    `static <T> Set<T>` | `emptySetOf(Class<T> type)`
    `static org.neo4j.kernel.impl.util.PrimitiveLongIterator` | `filter(PrimitiveLongPredicate predicate, org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)` Returns a new iterator with all elements found in the input iterator that are accepted by the given predicate
    `static <T> T` | `first(Iterable<T> iterable)` Returns the given iterable's first element.
    `static <T> T` | `first(Iterator<T> iterator)` Returns the given iterator's first element.
    `static <T> T` | `firstOrNull(Iterable<T> iterable)` Returns the given iterable's first element or `null` if no element found.
    `static <T> T` | `firstOrNull(Iterator<T> iterator)` Returns the given iterator's first element or `null` if no element found.
    `static org.neo4j.kernel.impl.util.PrimitiveLongIterator` | `flatten(Iterator<org.neo4j.kernel.impl.util.PrimitiveLongIterator> source)`
    `static <T> T` | `fromEnd(Iterable<T> iterable, int n)` Returns the iterator's n:th item from the end of the iteration.
    `static <T> T` | `fromEnd(Iterator<T> iterator, int n)` Returns the iterator's n:th item from the end of the iteration.
    `static <T> T` | `fromEndOrNull(Iterator<T> iterator, int n)` Returns the iterator's n:th item from the end of the iteration.
    `static <T> Iterator<T>` | `iterator(int maxItems, T... items)`
    `static <T> Iterator<T>` | `iterator(T... items)`
    `static boolean` | `iteratorsEqual(Iterator<?> first, Iterator<?> other)` Iterates over the full iterators, and checks equality for each item in them.
    `static <T> T` | `last(Iterable<T> iterable)` Returns the given iterable's last element.
    `static <T> T` | `last(Iterator<T> iterator)` Returns the given iterator's last element.
    `static <T> T` | `lastOrNull(Iterable<T> iterable)` Returns the given iterable's last element or `null` if no element found.
    `static <T> T` | `lastOrNull(Iterator<T> iterator)` Returns the given iterator's last element or `null` if no element found.
    `static <T> Iterable<T>` | `loop(Iterator<T> iterator)` Convenience method for looping over an `Iterator`.
    `static org.neo4j.kernel.impl.util.PrimitiveLongIterator` | `primitiveLongIterator(long... values)`
    `static List<Long>` | `primitivesList(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)`
    `static org.neo4j.kernel.impl.util.PrimitiveLongResourceIterator` | `resourceIterator(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator, Resource resource)`
    `static <T> Set<T>` | `set(T... items)` Alias for asSet()
    `static <T> T` | `single(Iterable<T> iterable)` Returns the given iterable's single element.
    `static <T> T` | `single(Iterable<T> iterable, T itemIfNone)` Returns the given iterable's single element or `null` if no element found.
    `static <T> T` | `single(Iterator<T> iterator)` Returns the given iterator's single element.
    `static <T> T` | `single(Iterator<T> iterator, T itemIfNone)` Returns the given iterator's single element or `itemIfNone` if no element found.
    `static long` | `single(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator, long itemIfNone)` Returns the given iterator's single element or `itemIfNone` if no element found.
    `static <T> T` | `singleOrNull(Iterable<T> iterable)` Returns the given iterable's single element or `null` if no element found.
    `static <T> T` | `singleOrNull(Iterator<T> iterator)` Returns the given iterator's single element or `null` if no element found.
    `static org.neo4j.kernel.impl.util.PrimitiveLongIterator` | `singletonPrimitiveLongIterator(long item)`
    `static Iterator<Long>` | `toJavaIterator(org.neo4j.kernel.impl.util.PrimitiveLongIterator primIterator)`
    `static int[]` | `toPrimitiveArray(Collection<Integer> integers)`
    `static org.neo4j.kernel.impl.util.PrimitiveIntIterator` | `toPrimitiveIntIterator(Iterator<Integer> iterator)`
    `static org.neo4j.kernel.impl.util.PrimitiveLongIterator` | `toPrimitiveLongIterator(Iterator<Long> iterator)`

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

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

- - ### Field Detail

    - #### ENUM_NAME

          public static final Function<Enum,String> ENUM_NAME

      Function for converting Enum to String

  - ### Constructor Detail

    - #### IteratorUtil

          public IteratorUtil()

  - ### Method Detail

    - #### firstOrNull

          public static <T> T firstOrNull(Iterator<T> iterator)

      Returns the given iterator's first element or `null` if no element found.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the first element in the `iterator`, or `null` if no element found.

    - #### first

          public static <T> T first(Iterator<T> iterator)

      Returns the given iterator's first element. If no element is found a `NoSuchElementException` is thrown.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the first element in the `iterator`.
      Throws:
        `NoSuchElementException` - if no element found.

    - #### lastOrNull

          public static <T> T lastOrNull(Iterator<T> iterator)

      Returns the given iterator's last element or `null` if no element found.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the last element in the `iterator`, or `null` if no element found.

    - #### last

          public static <T> T last(Iterator<T> iterator)

      Returns the given iterator's last element. If no element is found a `NoSuchElementException` is thrown.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the last element in the `iterator`.
      Throws:
        `NoSuchElementException` - if no element found.

    - #### singleOrNull

          public static <T> T singleOrNull(Iterator<T> iterator)

      Returns the given iterator's single element or `null` if no element found. If there is more than one element in the iterator a `NoSuchElementException` will be thrown.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the single element in `iterator`, or `null` if no element found.
      Throws:
        `NoSuchElementException` - if more than one element was found.

    - #### single

          public static <T> T single(Iterator<T> iterator)

      Returns the given iterator's single element. If there are no elements or more than one element in the iterator a `NoSuchElementException` will be thrown.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the single element in the `iterator`.
      Throws:
        `NoSuchElementException` - if there isn't exactly one element.

    - #### fromEnd

          public static <T> T fromEnd(Iterator<T> iterator,
                      int n)

      Returns the iterator's n:th item from the end of the iteration. If the iterator has got less than n-1 items in it `NoSuchElementException` is thrown.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
        `n` - the n:th item from the end to get.
      Returns:
        the iterator's n:th item from the end of the iteration.
      Throws:
        `NoSuchElementException` - if the iterator contains less than n-1 items.

    - #### fromEndOrNull

          public static <T> T fromEndOrNull(Iterator<T> iterator,
                            int n)

      Returns the iterator's n:th item from the end of the iteration. If the iterator has got less than n-1 items in it `null` is returned.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
        `n` - the n:th item from the end to get.
      Returns:
        the iterator's n:th item from the end of the iteration, or `null` if the iterator doesn't contain that many items.

    - #### iteratorsEqual

          public static boolean iteratorsEqual(Iterator<?> first,
                               Iterator<?> other)

      Iterates over the full iterators, and checks equality for each item in them. Note that this will consume the iterators.

    - #### firstOrNull

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

      Returns the given iterable's first element or `null` if no element found.
      Type Parameters:
        `T` - the type of elements in `iterable`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
      Returns:
        the first element in the `iterable`, or `null` if no element found.

    - #### first

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

      Returns the given iterable's first element. If no element is found a `NoSuchElementException` is thrown.
      Type Parameters:
        `T` - the type of elements in `iterable`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
      Returns:
        the first element in the `iterable`.
      Throws:
        `NoSuchElementException` - if no element found.

    - #### lastOrNull

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

      Returns the given iterable's last element or `null` if no element found.
      Type Parameters:
        `T` - the type of elements in `iterable`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
      Returns:
        the last element in the `iterable`, or `null` if no element found.

    - #### last

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

      Returns the given iterable's last element. If no element is found a `NoSuchElementException` is thrown.
      Type Parameters:
        `T` - the type of elements in `iterable`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
      Returns:
        the last element in the `iterable`.
      Throws:
        `NoSuchElementException` - if no element found.

    - #### singleOrNull

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

      Returns the given iterable's single element or `null` if no element found. If there is more than one element in the iterable a `NoSuchElementException` will be thrown.
      Type Parameters:
        `T` - the type of elements in `iterable`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
      Returns:
        the single element in `iterable`, or `null` if no element found.
      Throws:
        `NoSuchElementException` - if more than one element was found.

    - #### single

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

      Returns the given iterable's single element. If there are no elements or more than one element in the iterable a `NoSuchElementException` will be thrown.
      Type Parameters:
        `T` - the type of elements in `iterable`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
      Returns:
        the single element in the `iterable`.
      Throws:
        `NoSuchElementException` - if there isn't exactly one element.

    - #### single

          public static <T> T single(Iterable<T> iterable,
                     T itemIfNone)

      Returns the given iterable's single element or `null` if no element found. If there is more than one element in the iterable a `NoSuchElementException` will be thrown.
      Type Parameters:
        `T` - the type of elements in `iterable`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
      Returns:
        the single element in `iterable`, or `null` if no element found.
      Throws:
        `NoSuchElementException` - if more than one element was found.

    - #### single

          public static <T> T single(Iterator<T> iterator,
                     T itemIfNone)

      Returns the given iterator's single element or `itemIfNone` if no element found. If there is more than one element in the iterator a `NoSuchElementException` will be thrown.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the single element in `iterator`, or `itemIfNone` if no element found.
      Throws:
        `NoSuchElementException` - if more than one element was found.

    - #### single

          public static long single(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator,
                    long itemIfNone)

      Returns the given iterator's single element or `itemIfNone` if no element found. If there is more than one element in the iterator a `NoSuchElementException` will be thrown.
      Parameters:
        `iterator` - the `Iterator` to get elements from.
      Returns:
        the single element in `iterator`, or `itemIfNone` if no element found.
      Throws:
        `NoSuchElementException` - if more than one element was found.

    - #### filter

          public static org.neo4j.kernel.impl.util.PrimitiveLongIterator filter(PrimitiveLongPredicate predicate,
                                                                org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)

      Returns a new iterator with all elements found in the input iterator that are accepted by the given predicate
      Parameters:
        `predicate` - predicate to use for selecting elements
        `iterator` - input source of elements to be filtered
      Returns:
        new iterator that contains exactly all elements from iterator that are accepted by predicate

    - #### fromEnd

          public static <T> T fromEnd(Iterable<T> iterable,
                      int n)

      Returns the iterator's n:th item from the end of the iteration. If the iterator has got less than n-1 items in it `NoSuchElementException` is thrown.
      Type Parameters:
        `T` - the type of elements in `iterator`.
      Parameters:
        `iterable` - the `Iterable` to get elements from.
        `n` - the n:th item from the end to get.
      Returns:
        the iterator's n:th item from the end of the iteration.
      Throws:
        `NoSuchElementException` - if the iterator contains less than n-1 items.

    - #### addToCollection

          public static <C extends Collection<T>,T> C addToCollection(Iterator<T> iterator,
                                                      C collection)

      Adds all the items in `iterator` to `collection`.
      Type Parameters:
        `C` - the type of `Collection` to add to items to.
        `T` - the type of items in the collection and iterator.
      Parameters:
        `iterator` - the `Iterator` to grab the items from.
        `collection` - the `Collection` to add the items to.
      Returns:
        the `collection` which was passed in, now filled with the items from `iterator`.

    - #### addToCollection

          public static <C extends Collection<Long>> C addToCollection(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator,
                                                       C collection)

      Adds all the items in `iterator` to `collection`.
      Type Parameters:
        `C` - the type of `Collection` to add to items to.
      Parameters:
        `iterator` - the `Iterator` to grab the items from.
        `collection` - the `Collection` to add the items to.
      Returns:
        the `collection` which was passed in, now filled with the items from `iterator`.

    - #### addToCollection

          public static <C extends Collection<Integer>> C addToCollection(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator,
                                                          C collection)

      Adds all the items in `iterator` to `collection`.
      Type Parameters:
        `C` - the type of `Collection` to add to items to.
      Parameters:
        `iterator` - the `Iterator` to grab the items from.
        `collection` - the `Collection` to add the items to.
      Returns:
        the `collection` which was passed in, now filled with the items from `iterator`.

    - #### addToCollectionUnique

          public static <C extends Collection<T>,T> C addToCollectionUnique(Iterator<T> iterator,
                                                            C collection)

      Adds all the items in `iterator` to `collection`.
      Type Parameters:
        `C` - the type of `Collection` to add to items to.
        `T` - the type of items in the collection and iterator.
      Parameters:
        `iterator` - the `Iterator` to grab the items from.
        `collection` - the `Collection` to add the items to.
      Returns:
        the `collection` which was passed in, now filled with the items from `iterator`.

    - #### addToCollection

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

      Adds all the items in `iterator` to `collection`.
      Type Parameters:
        `C` - the type of `Collection` to add to items to.
        `T` - the type of items in the collection and iterator.
      Parameters:
        `iterable` - the `Iterator` to grab the items from.
        `collection` - the `Collection` to add the items to.
      Returns:
        the `collection` which was passed in, now filled with the items from `iterator`.

    - #### addToCollectionUnique

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

      Adds all the items in `iterator` to `collection`.
      Type Parameters:
        `C` - the type of `Collection` to add to items to.
        `T` - the type of items in the collection and iterator.
      Parameters:
        `iterable` - the `Iterator` to grab the items from.
        `collection` - the `Collection` to add the items to.
      Returns:
        the `collection` which was passed in, now filled with the items from `iterator`.

    - #### loop

          public static <T> Iterable<T> loop(Iterator<T> iterator)

      Convenience method for looping over an `Iterator`. Converts the `Iterator` to an `Iterable` by wrapping it in an `Iterable` that returns the `Iterator`. It breaks the contract of `Iterable` in that it returns the supplied iterator instance for each call to `iterator()` on the returned `Iterable` instance. This method exists to make it easy to use an `Iterator` in a for-loop.
      Type Parameters:
        `T` - the type of items in the iterator.
      Parameters:
        `iterator` - the iterator to expose as an `Iterable`.
      Returns:
        the supplied iterator posing as an `Iterable`.

    - #### asIterable

          public static <T> Iterable<T> asIterable(Iterator<T> iterator)

      Exposes `iterator` as an `Iterable`. It breaks the contract of `Iterable` in that it returns the supplied iterator instance for each call to `iterator()` on the returned `Iterable` instance. This method mostly exists to make it easy to use an `Iterator` in a for-loop.
      Type Parameters:
        `T` - the type of items in the iterator.
      Parameters:
        `iterator` - the iterator to expose as an `Iterable`.
      Returns:
        the supplied iterator posing as an `Iterable`.

    - #### count

          public static <T> int count(Iterator<T> iterator)

      Counts the number of items in the `iterator` by looping through it.
      Type Parameters:
        `T` - the type of items in the iterator.
      Parameters:
        `iterator` - the `Iterator` to count items in.
      Returns:
        the number of found in `iterator`.

    - #### count

          public static <T> int count(Iterable<T> iterable)

      Counts the number of items in the `iterable` by looping through it.
      Type Parameters:
        `T` - the type of items in the iterator.
      Parameters:
        `iterable` - the `Iterable` to count items in.
      Returns:
        the number of found in `iterator`.

    - #### asCollection

          public static <T> Collection<T> asCollection(Iterable<T> iterable)

      Creates a collection from an iterable.
      Type Parameters:
        `T` - The generic type of both the iterable and the collection.
      Parameters:
        `iterable` - The iterable to create the collection from.
      Returns:
        a collection containing all items from the iterable.

    - #### asCollection

          public static <T> Collection<T> asCollection(Iterator<T> iterable)

    - #### asList

          public static <T> List<T> asList(Iterator<T> iterator)

    - #### asList

          public static <T> List<T> asList(Iterable<T> iterator)

    - #### asList

          public static List<Long> asList(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)

    - #### asList

          public static List<Integer> asList(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator)

    - #### asSet

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

      Creates a `Set` from an `Iterable`.
      Type Parameters:
        `T` - The generic type of items.
      Parameters:
        `iterable` - The items to create the set from.
      Returns:
        a set containing all items from the `Iterable`.

    - #### asSet

          public static <T> Set<T> asSet(Iterator<T> iterator)

    - #### asUniqueSet

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

      Creates a `Set` from an `Iterable`.
      Type Parameters:
        `T` - The generic type of items.
      Parameters:
        `iterable` - The items to create the set from.
      Returns:
        a set containing all items from the `Iterable`.

    - #### asSet

          @SafeVarargs
          public static <T> Set<T> asSet(T... items)

      Creates a `Set` from an array of items.
      Parameters:
        `items` - the items to add to the set.
      Returns:
        the `Set` containing the items.

    - #### emptySetOf

          public static <T> Set<T> emptySetOf(Class<T> type)

    - #### emptyListOf

          public static <T> List<T> emptyListOf(Class<T> type)

    - #### set

          @SafeVarargs
          public static <T> Set<T> set(T... items)

      Alias for asSet()

    - #### asUniqueSet

          @SafeVarargs
          public static <T> Set<T> asUniqueSet(T... items)

      Creates a `Set` from an array of items.
      Parameters:
        `items` - the items to add to the set.
      Returns:
        the `Set` containing the items.

    - #### asUniqueSet

          public static <T> Set<T> asUniqueSet(Iterator<T> items)

      Creates a `Set` from an array of items.
      Parameters:
        `items` - the items to add to the set.
      Returns:
        the `Set` containing the items.

    - #### asEnumNameSet

          public static Set<String> asEnumNameSet(Iterable<Enum> enums)

      Converts an `Iterable` of enums to `Set` of their names.
      Parameters:
        `enums` - the enums to convert.
      Returns:
        the set of enum names

    - #### asEnumNameSet

          public static <E extends Enum<E>> Set<String> asEnumNameSet(Class<E> clazz)

      Converts an enum class to to `Set` of the names of all valid enum values
      Type Parameters:
        `E` - enum type bound
      Parameters:
        `clazz` - enum class
      Returns:
        the set of enum names

    - #### asIterable

          public static ClosableIterable<String> asIterable(File file,
                                            String encoding)

      Creates an `Iterable` for iterating over the lines of a text file.
      Parameters:
        `file` - the file to get the lines for.
      Returns:
        an `Iterable` for iterating over the lines of a text file.

    - #### asIterator

          public static ClosableIterator<String> asIterator(File file,
                                            String encoding)
                                                     throws IOException

      Creates an `Iterator` for iterating over the lines of a text file. The opened file is closed if an exception occurs during reading or when the files has been read through all the way.
      Parameters:
        `file` - the file to get the lines for.
        `encoding` - to be used for reading the file
      Returns:
        an `Iterator` for iterating over the lines of a text file.
      Throws:
        `IOException`

    - #### asIterable

          public static Iterable<Long> asIterable(long... array)

    - #### asIterable

          @SafeVarargs
          public static <T> Iterable<T> asIterable(T... array)

    - #### asIterator

          public static Iterator<Long> asIterator(long... array)

    - #### asPrimitiveIterator

          public static org.neo4j.kernel.impl.util.PrimitiveLongIterator asPrimitiveIterator(long... array)

    - #### asPrimitiveIterator

          public static org.neo4j.kernel.impl.util.PrimitiveIntIterator asPrimitiveIterator(int... array)

    - #### asIterator

          @SafeVarargs
          public static <T> Iterator<T> asIterator(int maxItems,
                                               T... array)

    - #### iterator

          @SafeVarargs
          public static <T> Iterator<T> iterator(T... items)

    - #### iterator

          @SafeVarargs
          public static <T> Iterator<T> iterator(int maxItems,
                                             T... items)

    - #### singletonPrimitiveLongIterator

          public static org.neo4j.kernel.impl.util.PrimitiveLongIterator singletonPrimitiveLongIterator(long item)

    - #### emptyIterator

          public static <T> ResourceIterator<T> emptyIterator()

    - #### emptyPrimitiveLongIterator

          public static org.neo4j.kernel.impl.util.PrimitiveLongIterator emptyPrimitiveLongIterator()

    - #### emptyPrimitiveIntIterator

          public static org.neo4j.kernel.impl.util.PrimitiveIntIterator emptyPrimitiveIntIterator()

    - #### contains

          public static <T> boolean contains(Iterator<T> iterator,
                             T item)

    - #### contains

          public static boolean contains(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator,
                         long item)

    - #### contains

          public static boolean contains(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator,
                         int item)

    - #### cloned

          public static <T extends CloneableInPublic> Iterable<T> cloned(Iterable<T> items,
                                                         Class<T> itemClass)

    - #### asResourceIterator

          public static <T> ResourceIterator<T> asResourceIterator(Iterator<T> iterator)

    - #### toJavaIterator

          public static Iterator<Long> toJavaIterator(org.neo4j.kernel.impl.util.PrimitiveLongIterator primIterator)

    - #### primitivesList

          public static List<Long> primitivesList(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)

    - #### asSet

          public static Set<Long> asSet(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)

    - #### asSet

          public static Set<Integer> asSet(org.neo4j.kernel.impl.util.PrimitiveIntIterator iterator)

    - #### asUniqueSet

          public static Set<Long> asUniqueSet(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator)

      Creates a `Set` from an array of iterator.
      Parameters:
        `iterator` - the iterator to add to the set.
      Returns:
        the `Set` containing the iterator.

    - #### toPrimitiveLongIterator

          public static org.neo4j.kernel.impl.util.PrimitiveLongIterator toPrimitiveLongIterator(Iterator<Long> iterator)

    - #### toPrimitiveIntIterator

          public static org.neo4j.kernel.impl.util.PrimitiveIntIterator toPrimitiveIntIterator(Iterator<Integer> iterator)

    - #### flatten

          public static org.neo4j.kernel.impl.util.PrimitiveLongIterator flatten(Iterator<org.neo4j.kernel.impl.util.PrimitiveLongIterator> source)

    - #### resourceIterator

          public static org.neo4j.kernel.impl.util.PrimitiveLongResourceIterator resourceIterator(org.neo4j.kernel.impl.util.PrimitiveLongIterator iterator,
                                                                                  Resource resource)

    - #### primitiveLongIterator

          public static org.neo4j.kernel.impl.util.PrimitiveLongIterator primitiveLongIterator(long... values)

    - #### toPrimitiveArray

          public static int[] toPrimitiveArray(Collection<Integer> integers)

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