Here you can find the source of readMap(final ResultSet rs)
public static Map<String, Object> readMap(final 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.LinkedHashMap; import java.util.Map; public class Main { public static Map<String, Object> readMap(final ResultSet rs) throws SQLException { final Map<String, Object> values = new LinkedHashMap<>(); final ResultSetMetaData metaData = rs.getMetaData(); for (int i = 1; i <= metaData.getColumnCount(); i++) { final String name = metaData.getColumnName(i); final Object value = rs.getObject(i); values.put(name, value);//from w w w . j a v a 2 s . c o m } return values; } }