Here you can find the source of resultSetToArrayList(ResultSet rs)
public static List<HashMap> resultSetToArrayList(ResultSet rs) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class Main { public static List<HashMap> resultSetToArrayList(ResultSet rs) throws SQLException { ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); ArrayList list = new ArrayList(); while (rs.next()) { HashMap row = new HashMap(columns); for (int i = 1; i <= columns; ++i) { row.put(md.getColumnName(i), rs.getObject(i)); }/*w w w .ja va 2 s . co m*/ list.add(row); } return list; } }