FileDocCategorySizeDatePackage
HitIterator.javaAPI DocApache Lucene 2.1.02107Wed Feb 14 10:46:40 GMT 2007org.apache.lucene.search

HitIterator

public class HitIterator extends Object implements Iterator
An iterator over {@link Hits} that provides lazy fetching of each document. {@link Hits#iterator()} returns an instance of this class. Calls to {@link #next()} return a {@link Hit} instance.
author
Jeremy Rayner

Fields Summary
private Hits
hits
private int
hitNumber
Constructors Summary
HitIterator(Hits hits)
Constructed from {@link Hits#iterator()}.


         
    
    this.hits = hits;
  
Methods Summary
public booleanhasNext()

return
true if current hit is less than the total number of {@link Hits}.

    return hitNumber < hits.length();
  
public intlength()
Returns the total number of hits.

    return hits.length();
  
public java.lang.Objectnext()
Returns a {@link Hit} instance representing the next hit in {@link Hits}.

return
Next {@link Hit}.

    if (hitNumber == hits.length())
      throw new NoSuchElementException();

    Object next = new Hit(hits, hitNumber);
    hitNumber++;
    return next;
  
public voidremove()
Unsupported operation.

throws
UnsupportedOperationException

    throw new UnsupportedOperationException();