Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Populating an ArrayList()  RSS feed

 
Rick Harrison
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the best way to populate an ArrayList() from a sybase stored procedure result set? Thanks
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a class that has variables for each of the columns in your table. To be truly OO, you can make the variables private and add public get and set methods for each one. Instantiate one of these, add the columns to it, and add the object to your ArrayList. Instantiate a new one, add the columns, etc. until there are no more rows. Not recommended for ResultSets containing 25 million rows.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!