public List<R> extractData(ResultSet rs) throws SQLException {
		List<R> results = new ArrayList<>();
		int row = 0;
		boolean more = rs.next();
		if (more) {
			row++;
		}
		while (more) {
			R root = rootMapper.mapRow(rs, row);
			K primaryKey = mapPrimaryKey(rs);
			if (mapForeignKey(rs) != null) {
				while (more && primaryKey.equals(mapForeignKey(rs))) {
					addChild(root, childMapper.mapRow(rs, row));
					more = rs.next();
					if (more) {
						row++;
					}
				}
			}
			else {
				more = rs.next();
				if (more) {
					row++;
				}
			}
			results.add(root);
		}
		if ((expectedResults == ExpectedResults.ONE_AND_ONLY_ONE || expectedResults == ExpectedResults.ONE_OR_NONE) &&
				results.size() > 1) {
			throw new IncorrectResultSizeDataAccessException(1, results.size());
		}
		if ((expectedResults == ExpectedResults.ONE_AND_ONLY_ONE || expectedResults == ExpectedResults.AT_LEAST_ONE) &&
				results.isEmpty()) {
			throw new IncorrectResultSizeDataAccessException(1, 0);
		}
		return results;
	}
Creates a new {@link OneToManyResultSetExtractor} from the given {@link RowMapper}s and {@link ExpectedResults}.

@param rootMapper {@link RowMapper} to map the root entity, must not be {@literal null}.
@param childMapper {@link RowMapper} to map the root entities, must not be {@literal null}.
@param expectedResults
src/main/java/org/springframework/samples/petclinic/repository/jdbc/OneToManyResultSetExtractor.java