private void findNext() {
            int nextState;
            int depth;

            if (item.symbol == 256 || item.fsa == null) {
                throw new NoSuchElementException();
            }

            // flip the flag now that the first state has been returned
            if (useInitState) {
                useInitState = false;
            }

            // try to find the next final state
            for(;;) {
                item.symbol++;
                if (item.symbol < 256) {
                    byte symbol = (byte)item.symbol;
                    nextState = item.fsa.delta(item.state, (byte)item.symbol);
                    if (nextState != 0) {
                        item.string.push((byte)item.symbol);
                        item.stack.push(item.state);
                        item.state = nextState;
                        item.symbol = 0;
                        if (item.fsa.isFinal(nextState)) {
                            break;
                        }
                    }
                } else { // backtrack
                    if ((depth = item.string.size()) > 0) {
                        byte b = item.string.pop(); // remove the last byte
                        item.symbol = b < 0 ? b + 256 : b;
                        item.state = item.stack.pop();
                    } else {
                        item.state = 0;
                        break;
                    }
                }
            }
        }
Constructor.
@param state the state to create the iterator from.
fsa/src/main/java/com/yahoo/fsa/FSA.java