code: @Override
      public T next() {
  
          /* If the item is null and we are complete then calling this is a programming error. */
          if (next == null && complete) {
              throw new NoSuchElementException("The stream has completed. There are no more items.");
          }
  
          /* If the item is an error, throw the error wrapped by a runtime error. */
          if (next == ERROR) {
              try {
                  final Object error = blockingQueue.take();
                  complete = true;
                  throw new StreamException("Exception from stream", (Throwable) error);
              } catch (InterruptedException e) {
                  Thread.interrupted();
                  throw new StreamException("Stream sent error but unable to get error from stream", e);
              }
          } else {
              /* Give them the next item but don't store the next item any longer. */
              T theNext = next;
              next = null;
              return theNext;
          }
      }
docs: Returns the next element in the iteration.
  This will throw a {@code StreamException} wrapping the error sent from the stream.
  
  @return the next element in the iteration
  @throws NoSuchElementException if the iteration has no more elements