public synchronized boolean add(E e,boolean hasNext){
  while (mInternalQueue.size() >= mMaxSize && !mClosed) {
    notifyAll();
    try {
      wait(TIMEOUT);
    }
 catch (    InterruptedException e1) {
      mClosed=true;
      ProgramState.checkAbort();
      throw new IllegalStateException("Interrupted but program not aborting?",e1);
    }
    ProgramState.checkAbort();
  }
  if (mClosed) {
    return true;
  }
  final boolean wasEmpty=mInternalQueue.isEmpty();
  mHasNext=hasNext;
  mInternalQueue.add(e);
  if (wasEmpty) {
    notifyAll();
  }
  return true;
}

public synchronized boolean add ( E e , boolean hasNext ) { while ( mInternalQueue . size ( ) >= mMaxSize && ! mClosed ) { notifyAll ( ) ; try { wait ( TIMEOUT ) ; } catch ( InterruptedException e1 ) { mClosed = true ; ProgramState . checkAbort ( ) ; throw new IllegalStateException ( "Interrupted but program not aborting?" , e1 ) ; } ProgramState . checkAbort ( ) ; } if ( mClosed ) { return true ; } final boolean wasEmpty = mInternalQueue . isEmpty ( ) ; mHasNext = hasNext ; mInternalQueue . add ( e ) ; if ( wasEmpty ) { notifyAll ( ) ; } return true ; }
add method which also set whether there is a next value
