Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populating an ArrayList()

 
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