我可以只获取当前行并将其传递给函数,所以我可以这样做:
List<Map<String, Object>> returnList = new ArrayList<Map<String,Object>>();
while (result.next()) {
Map<String, Object> returnMap = new HashMap<String, Object>();
int hasSchedule = result.getInt("hasSchedule"); // get just one column and do some operation
if (hasSchedule == 1) {
}
returnMap = DbUtility.convertResultSetToMap(result); // add columns of the of the current resultset to the map...
returnList.add(returnMap);
}
我的结果集中通常有超过10列,所以我打算写这样的东西以节省时间。