I have an ArrayList that holds the data from a query performed on a SQL database. I am now trying to take that list and create a new table model.

I got the row count. What I have found online for the column count doesn't seem to be valid.

Java Code:
int rows, cols;
rows = list.size();
cols = list.get(0).length; // not valid, no length or size parameter
So I guess I have two questions:
1. How do I actually get the length/size of the first object to know the column count?
2. Once known, how to I iterate through to create header titles?