Here you can find the source of getList(ResultSet resultSet, String columnLabel, Class
public static <T> List<T> getList(ResultSet resultSet, String columnLabel, Class<T> clazz) throws SQLException
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Array; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; import java.util.List; public class Main { public static <T> List<T> getList(ResultSet resultSet, String columnLabel, Class<T> clazz) throws SQLException { return Arrays.asList(getArray(resultSet, columnLabel, clazz)); }/*from w w w.j ava2 s . c om*/ public static <T> List<T> getList(ResultSet resultSet, int columnIndex, Class<T> clazz) throws SQLException { return Arrays.asList(getArray(resultSet, columnIndex, clazz)); } public static <T> T[] getArray(ResultSet resultSet, String columnLabel, Class<T> clazz) throws SQLException { @SuppressWarnings("unchecked") T[] array = (T[]) resultSet.getArray(columnLabel).getArray(); if (array != null) { return array; } @SuppressWarnings("unchecked") T[] empty = (T[]) Array.newInstance(clazz, 0); return empty; } public static <T> T[] getArray(ResultSet resultSet, int columnIndex, Class<T> clazz) throws SQLException { @SuppressWarnings("unchecked") T[] array = (T[]) resultSet.getArray(columnIndex).getArray(); if (array != null) { return array; } @SuppressWarnings("unchecked") T[] empty = (T[]) Array.newInstance(clazz, 0); return empty; } }