code: public boolean hasNext() {
          // check if we already fetched next item
          if (next != null) {
              return true;
          }
  
          // check if result set already finished
          if (resultSetFinished) {
              return false;
          }
  
          // now fetch next item
          next = safeReadNext();
  
          // check if we got something
          if (next != null) {
              return true;
          }
  
          // no more items
          resultSetFinished = true;
  
          return false;
      }
docs: used to note when result set exhausted