Here you can find the source of getResultByMap(ResultSet rs)
private static List<Object> getResultByMap(ResultSet rs) throws SQLException
//package com.java2s; //License from project: Apache 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; import java.util.Map; public class Main { private static List<Object> getResultByMap(ResultSet rs) throws SQLException { List<Object> list = new ArrayList<Object>(); ResultSetMetaData rsmData = rs.getMetaData(); while (rs.next()) { Map<Object, Object> map = new HashMap<Object, Object>(); for (int i = 1; i <= rsmData.getColumnCount(); i++) { map.put(rsmData.getColumnName(i), rs.getObject(i)); }// w ww. j a v a 2 s .co m list.add(map); } return list; } }