core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorCluster.java
@SuppressWarnings("unchecked")
  public REC next() {
    checkDirection(true);

    ORecord record;

    // ITERATE UNTIL THE NEXT GOOD RECORD
    while (hasNext()) {
      // FOUND
      if (currentRecord != null) {
        try {
          return (REC) currentRecord;
        } finally {
          currentRecord = null;
        }
      }

      record = getTransactionEntry();
      if (record != null)
        return (REC) record;
    }

    return null;
  }
@SuppressWarnings("unchecked")
  public REC next() {
    checkDirection(true);

    ORecord record;

    // ITERATE UNTIL THE NEXT GOOD RECORD
    while (hasNext()) {
      // FOUND
      if (currentRecord != null) {
        try {
          return (REC) currentRecord;
        } finally {
          currentRecord = null;
        }
      }

      record = getTransactionEntry();
      if (record != null)
        return (REC) record;
    }

    return null;
  }
Return the element at the current position and move forward the cursor to the next position available.

@return the next record found, otherwise the NoSuchElementException exception is thrown when no more records are found.