static ExtendedCellScanner getCellScanner(final List<List<? extends ExtendedCell>> cells,
    final int size) {
    return new SizedExtendedCellScanner() {
      private final Iterator<List<? extends ExtendedCell>> entries = cells.iterator();
      private Iterator<? extends ExtendedCell> currentIterator = null;
      private ExtendedCell currentCell;

      @Override
      public ExtendedCell current() {
        return this.currentCell;
      }

      @Override
      public boolean advance() {
        if (this.currentIterator == null) {
          if (!this.entries.hasNext()) {
            return false;
          }
          this.currentIterator = this.entries.next().iterator();
        }
        if (this.currentIterator.hasNext()) {
          this.currentCell = this.currentIterator.next();
          return true;
        }
        this.currentCell = null;
        this.currentIterator = null;
        return advance();
      }

      @Override
      public long heapSize() {
        return size;
      }
    };
  }
Returns <code>cells</code> packaged as a CellScanner
hbase-server/src/main/java/org/apache/hadoop/hbase/protobuf/ReplicationProtobufUtil.java