## org.apache.mahout.common.iterator
Class IteratorUtils

    java.lang.Object
      org.apache.mahout.common.iterator.IteratorUtils

    public final class IteratorUtils

extends java.lang.Object

`Iterator`-related methods without a better home.

Method Summary

`static

`<K> java.util.List<K>`

`

`iterableToList(java.lang.Iterable<K> iterable)`

`static

`<K> java.util.List<K>`

`

`iterableToList(java.lang.Iterable<K> iterable, java.util.Comparator<K> comparator)`

`static long[]` `longIteratorToList(LongPrimitiveIterator iterator)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### iterableToList

    public static <K> java.util.List<K> iterableToList(java.lang.Iterable<K> iterable)

  Parameters:
    `iterable` - `Iterable` whose contents are to be put into a `List`
  Returns:
    a `List` with the objects one gets by iterating over the given `Iterable`

### longIteratorToList

    public static long[] longIteratorToList(LongPrimitiveIterator iterator)

### iterableToList

    public static <K> java.util.List<K> iterableToList(java.lang.Iterable<K> iterable,
                                                       java.util.Comparator<K> comparator)

  Parameters:
    `iterable` - `Iterable` whose contents are to be put into a `List`
    `comparator` - `Comparator` defining the sort order of the returned `List`
  Returns:
    a `List` with the objects one gets by iterating over the given `Iterable`, sorted according to the given `Comparator`

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.