Here you can find the source of getColumnLabelMap(ResultSet resultSet)
public static Map<String, Integer> getColumnLabelMap(ResultSet resultSet)
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, Integer> getColumnLabelMap(ResultSet resultSet) { Map<String, Integer> map = new HashMap<String, Integer>(); try {//from w w w.j a v a 2 s .c o m ResultSetMetaData rsmd = resultSet.getMetaData(); int columnCount = rsmd.getColumnCount(); for (int i = 1; i <= columnCount; i++) { map.put(rsmd.getColumnLabel(i), 1); } } catch (Exception e) { e.printStackTrace(); } return map; } public static int getColumnCount(ResultSet resultSet) { int columnCount = -1; try { ResultSetMetaData rsmd = resultSet.getMetaData(); columnCount = rsmd.getColumnCount(); } catch (Exception e) { e.printStackTrace(); } return columnCount; } }