Here you can find the source of toColumnNameList(final ResultSet rs)
private static List<String> toColumnNameList(final ResultSet rs) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; public class Main { private static List<String> toColumnNameList(final ResultSet rs) throws SQLException { final Map<Integer, String> columnNames = new TreeMap<Integer, String>(); while (rs.next()) { columnNames.put(rs.getInt("ORDINAL_POSITION"), rs.getString("COLUMN_NAME")); }// www.ja v a 2 s . c o m return new ArrayList<String>(columnNames.values()); } }