code: private List iterateAndReturn(ResultSet rSet) {
          Iterator<Row> rowIter = rSet.iterator();
          List results = new ArrayList();
  
          while (rowIter.hasNext()) {
              Row row = rowIter.next();
              ColumnDefinitions columnDefs = row.getColumnDefinitions();
              Iterator<Definition> columnDefIter = columnDefs.iterator();
              Map rowData = new HashMap();
              while (columnDefIter.hasNext()) {
                  Definition columnDef = columnDefIter.next();
                  rowData.put(columnDef.getName(), DSClientUtilities.assign(row, null, null,
                      columnDef.getType().getName(), null, columnDef.getName(), null, null));
              }
              results.add(rowData);
          }
          return results;
      }
docs: Iterate and return.
  
  @param rSet
  the r set
  @return the list