qbit/core/src/main/java/io/advantageous/qbit/stream/StreamToIterator.java
@Override
    public boolean hasNext() {

        /* If we are in the completed state let the end user know. */
        if (complete) {
            return false;
        }

        /* If we called hasNext twice, do not poll the queue. */
        if (next != null) {
            return true;
        }

        /* Get the item from the queue, and block until we do. */
        Object item = null;

        while (item == null) {
            try {
                item = blockingQueue.take();
            } catch (InterruptedException e) {
                Thread.interrupted();
            }
        }

        /* Check to see if the complete message was sent.
        * If so mark this iterator has completed and set the next item to null.
        */
        if (item == COMPLETE) {
            complete = true;
            next = null;
            return false;
        } else {
            /* Store the next item. */
            next = (T) item;
            return true;
        }

    }
@Override
    public boolean hasNext() {

        /* If we are in the completed state let the end user know. */
        if (complete) {
            return false;
        }

        /* If we called hasNext twice, do not poll the queue. */
        if (next != null) {
            return true;
        }

        /* Get the item from the queue, and block until we do. */
        Object item = null;

        while (item == null) {
            try {
                item = blockingQueue.take();
            } catch (InterruptedException e) {
                Thread.interrupted();
            }
        }

        /* Check to see if the complete message was sent.
        * If so mark this iterator has completed and set the next item to null.
        */
        if (item == COMPLETE) {
            complete = true;
            next = null;
            return false;
        } else {
            /* Store the next item. */
            next = (T) item;
            return true;
        }

    }
Returns {@code true} if the iteration has more elements.
(In other words, returns {@code true} if {@link #next} would
return an element rather than throwing an exception.)
<p>
Checks to see if the stream is closed or has sent an error.

@return {@code true} if the iteration has more elements