## org.apache.lucene.search
Class HitIterator

    java.lang.Object
      org.apache.lucene.search.HitIterator

All Implemented Interfaces:
  Iterator

    public class HitIterator

extends Object
implements Iterator

An iterator over `Hits` that provides lazy fetching of each document. `Hits.iterator()` returns an instance of this class. Calls to `next()` return a `Hit` instance.

Author:
  Jeremy Rayner

Method Summary
`boolean` `hasNext()`
`int` `length()` Returns the total number of hits.
`Object` `next()` Returns a `Hit` instance representing the next hit in `Hits`.
`void` `remove()` Unsupported operation.

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

Method Detail

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `Iterator`
  Returns:
    true if current hit is less than the total number of `Hits`.

### next

    public Object next()

  Returns a `Hit` instance representing the next hit in `Hits`.

  Specified by:
    `next` in interface `Iterator`
  Returns:
    Next `Hit`.

### remove

    public void remove()

  Unsupported operation.

  Specified by:
    `remove` in interface `Iterator`
  Throws:
    `UnsupportedOperationException`

### length

    public int length()

  Returns the total number of hits.

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.