## org.apache.lucene.facet.search
Interface CategoryListIterator

All Known Implementing Classes:
  MultiCategoryListIterator, PayloadIntDecodingIterator

    public interface CategoryListIterator

An interface for iterating over a "category list", i.e., the list of categories per document.

NOTE:

- This class operates as a key to a Map. Appropriate implementation of `hashCode()` and `equals()` must be provided.
- `init()` must be called before you consume any categories, or call `skipTo(int)`.
- `skipTo(int)` must be called before any calls to `nextCategory()`.
- `nextCategory()` returns values < `Integer.MAX_VALUE`, so you can use it as a stop condition.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Method Summary
`boolean` `init()` Initializes the iterator.
`long` `nextCategory()` Returns the next category for the current document that is set through `skipTo(int)`, or a number higher than `Integer.MAX_VALUE`.
`boolean` `skipTo(int docId)` Skips forward to document docId.

Method Detail

### init

    boolean init()
                 throws IOException

  Initializes the iterator. This method must be called before any calls to `skipTo(int)`, and its return value indicates whether there are any relevant documents for this iterator. If it returns false, any call to `skipTo(int)` will return false as well.
  NOTE: calling this method twice may result in skipping over documents for some implementations. Also, calling it again after all documents were consumed may yield unexpected behavior.

  Throws:
    `IOException`

### skipTo

    boolean skipTo(int docId)
                   throws IOException

  Skips forward to document docId. Returns true iff this document exists and has any categories. This method must be called before calling `nextCategory()` for a particular document.
  NOTE: Users should call this method with increasing docIds, and implementations can assume that this is the case.

  Throws:
    `IOException`

### nextCategory

    long nextCategory()
                      throws IOException

  Returns the next category for the current document that is set through `skipTo(int)`, or a number higher than `Integer.MAX_VALUE`. No assumptions can be made on the order of the categories.

  Throws:
    `IOException`