class FlatIterator<T> extends GridIteratorAdapter<T> {
    /** */
    private static final long serialVersionUID = 0L;

    /** */
    private Iterator<?> iter;

    /** */
    private Iterator<T> next;

    /** */
    private boolean moved;

    /** */
    private boolean more;

    /**
     * @param iterable Input iterable of iterators.
     */
    public FlatIterator(Iterable<?> iterable) {
        iter = iterable.iterator();
        moved = true;
    }

    /** {@inheritDoc} */
    @SuppressWarnings("unchecked")
    @Override public boolean hasNextX() {<FILL_FUNCTION_BODY>}

    /** {@inheritDoc} */
    @Override public T nextX() {
        if (hasNext()) {
            moved = true;

            return next.next();
        }

        throw new NoSuchElementException();
    }

    /** {@inheritDoc} */
    @Override public void removeX() {
        assert next != null;

        next.remove();
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(FlatIterator.class, this);
    }
}

        if (!moved)
            return more;

        moved = false;

        if (next != null && next.hasNext())
            return more = true;

        while (iter.hasNext()) {
            Object obj = iter.next();

            if (obj instanceof Iterable)
                next = ((Iterable)obj).iterator();
            else if (obj instanceof Iterator)
                next = (Iterator)obj;
            else
                assert false : "Iterable or Iterator are expected";

            if (next.hasNext())
                return more = true;
        }

        return more = false;
    
<methods>public non-sealed void <init>() ,public final boolean hasNext() ,public final Iterator<T> iterator() ,public final T next() ,public final void remove() <variables>private static final long serialVersionUID