/** * Turn the result set into a java.util.List * @param resultSet The result set * @return List of QuerySolutions */ static public List<QuerySolution> toList(ResultSet resultSet) { List<QuerySolution> list = new ArrayList<>() ; for ( ; resultSet.hasNext() ; ) { QuerySolution result = resultSet.nextSolution() ; materialize(result); list.add(result) ; } return list ; }
/** This operation faithfully walks the results but does nothing with them. * @return The count of the number of solutions. */ public static int consume(ResultSet resultSet) { int count = 0 ; for ( ; resultSet.hasNext() ; ) { // Force nodes to be materialized. QuerySolution result = resultSet.nextSolution() ; materialize(result); count++ ; } return count ; }