Here you can find the source of toArrayList(ResultSet rs)
@SuppressWarnings("unchecked") public static List toArrayList(ResultSet rs)
//package com.java2s; //License from project: Apache License import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; public class Main { @SuppressWarnings("unchecked") public static List toArrayList(ResultSet rs) { List arrayList = null;/*from w ww. jav a 2 s . com*/ try { arrayList = new ArrayList(); int iCol = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] objArray = new Object[iCol]; for (int i = 1; i <= iCol; i++) { objArray[i - 1] = rs.getObject(i); } arrayList.add(objArray); } } catch (Exception e) { throw new RuntimeException(e.getMessage()); } return arrayList; } }