Here you can find the source of extractResultSetFiledNames(ResultSet result)
public static Set<String> extractResultSetFiledNames(ResultSet result) 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.HashSet; import java.util.Set; public class Main { public static Set<String> extractResultSetFiledNames(ResultSet result) throws SQLException { ResultSetMetaData rsmd = result.getMetaData(); Set<String> columnsSet = new HashSet<>(); int columns = rsmd.getColumnCount(); for (int x = 1; x <= columns; x++) { columnsSet.add(rsmd.getColumnName(x)); }/*from ww w. jav a2 s . c om*/ return columnsSet; } }