edu.berkeley.nlp.lm.collections
Class Iterators

java.lang.Object
  extended by edu.berkeley.nlp.lm.collections.Iterators

public class Iterators
extends Object

Utilities for dealing with Iterators

Author:
adampauls

Nested Class Summary
static class Iterators.IteratorIterator<T>
          Wraps a two-level iteration scenario in an iterator.
static class Iterators.Transform<S,T>
          Wraps a base iterator with a transformation function.
 
Constructor Summary
Iterators()
           
 
Method Summary
static
<T> Iterable<T>
able(Iterator<T> it)
          Wraps an Iterator as an Iterable
static
<T> Iterable<T>
flatten(Iterator<Iterator<T>> iters)
           
static
<S,T> Iterator<Pair<S,T>>
zip(Iterator<S> s, Iterator<T> t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Iterators

public Iterators()
Method Detail

able

public static <T> Iterable<T> able(Iterator<T> it)
Wraps an Iterator as an Iterable

Type Parameters:
T -
Parameters:
it -
Returns:

flatten

public static <T> Iterable<T> flatten(Iterator<Iterator<T>> iters)

zip

public static <S,T> Iterator<Pair<S,T>> zip(Iterator<S> s,
                                            Iterator<T> t)