org.entityfs.util.itr
Class Iterators

java.lang.Object
  extended by org.entityfs.util.itr.Iterators

public final class Iterators
extends Object

This is a utility class with static methods for working with Iterator :s.

Since:
1.0
Author:
Karl Gustafsson

Method Summary
static
<T> List<T>
list(Iterator<T> itr)
          This iterates through the provided Iterator and returns a List with the returned elements in the order that they were returned in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

list

public static <T> List<T> list(Iterator<T> itr)
This iterates through the provided Iterator and returns a List with the returned elements in the order that they were returned in.

This corresponds to Java's Collections.list method, only that it takes an Iterator argument instead of an Enumeration (making it infinitely more useful for EntityFS purposes).

Type Parameters:
T - The type of elements returned by the iterator.
Parameters:
itr - The iterator.
Returns:
A list with all elements returned from the iterator, in the order that they were returned.