private Entry<Long, Long> sumTable(ResultScanner scanner) {
    long rowsObserved = 0L;
    long entriesObserved = 0L;

    // Read all the records in the table
    for (Result result : scanner) {
      rowsObserved++;
      while (result.advance()) {
        entriesObserved++;
      }
    }
    return Maps.immutableEntry(rowsObserved, entriesObserved);
  }
Count the number of rows and the number of entries from a scanner The Scanner
@return An entry where the first item is rows observed and the second is entries observed.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSizeFailures.java