Package org.apache.lucene.util.automaton

## Class LimitedFiniteStringsIterator

- java.lang.Object
- - org.apache.lucene.util.automaton.FiniteStringsIterator
  - - org.apache.lucene.util.automaton.LimitedFiniteStringsIterator

-     public class LimitedFiniteStringsIterator
      extends FiniteStringsIterator

  `FiniteStringsIterator` which limits the number of iterated accepted strings. If more than `limit` strings are accepted, the first `limit` strings found are returned.

  If the `Automaton` has cycles then this iterator may throw an `IllegalArgumentException`, but this is not guaranteed!

  Be aware that the iteration order is implementation dependent and may change across releases.

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

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LimitedFiniteStringsIterator​(Automaton a, int limit)` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `IntsRef` | `next()` | Generate next finite string.
    `int` | `size()` | Number of iterated finite strings.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LimitedFiniteStringsIterator

          public LimitedFiniteStringsIterator​(Automaton a,
                                              int limit)

      Constructor.
      Parameters:
        `a` - Automaton to create finite string from.
        `limit` - Maximum number of finite strings to create, or -1 for infinite.

  - ### Method Detail

    - #### next

          public IntsRef next()

      Description copied from class: `FiniteStringsIterator`
      Generate next finite string. The return value is just valid until the next call of this method!
      Overrides:
        `next` in class `FiniteStringsIterator`
      Returns:
        Finite string or null, if no more finite strings are available.

    - #### size

          public int size()

      Number of iterated finite strings.