## edu.stanford.nlp.objectbank
Class LineIterator<X>

    java.lang.Object
      edu.stanford.nlp.util.AbstractIterator<X>
          edu.stanford.nlp.objectbank.LineIterator<X>

All Implemented Interfaces:
  Iterator<X>

    public class LineIterator<X>

extends AbstractIterator<X>

An Iterator that returns a line of a file at a time. Lines are broken as determined by Java's readLine() method. The returned lines do not include the newline character.

Author:
  Christopher Manning

Nested Class Summary
`static class` `LineIterator.LineIteratorFactory<X>`

Constructor Summary
`LineIterator(Reader r)`
`LineIterator(Reader r, Function<String,X> op)`

Method Summary

`static

`<X> IteratorFromReaderFactory<X>`

`

`getFactory()`
Returns a factory that vends LineIterators that read the contents of the given Reader, splitting on newlines.

`static

`<X> IteratorFromReaderFactory<X>`

`

`getFactory(Function<String,X> op)`
Returns a factory that vends LineIterators that read the contents of the given Reader, splitting on newlines.

`boolean` `hasNext()`
`static void` `main(String[] args)`
`X` `next()`
`Object` `peek()`

Methods inherited from class edu.stanford.nlp.util.AbstractIterator
`remove`

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

Constructor Detail

### LineIterator

    public LineIterator(Reader r)

### LineIterator

    public LineIterator(Reader r,
                        Function<String,X> op)

Method Detail

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `Iterator<X>`
  Specified by:
    `hasNext` in class `AbstractIterator<X>`

### next

    public X next()

  Specified by:
    `next` in interface `Iterator<X>`
  Specified by:
    `next` in class `AbstractIterator<X>`

### peek

    public Object peek()

### getFactory

    public static <X> IteratorFromReaderFactory<X> getFactory()

  Returns a factory that vends LineIterators that read the contents of the given Reader, splitting on newlines.

  Returns:
    An iterator over the lines of a file

### getFactory

    public static <X> IteratorFromReaderFactory<X> getFactory(Function<String,X> op)

  Returns a factory that vends LineIterators that read the contents of the given Reader, splitting on newlines.

  Parameters:
    `op` - A function to be applied to each line before it is returned
  Returns:
    An iterator over the lines of a file

### main

    public static void main(String[] args)

Stanford NLP Group