Results 1 to 2 of 2
- 07-22-2009, 04:28 PM #1Senior Member
- Join Date
- Mar 2009
- Rep Power
Creating int but size needes to vary
I need to create an int array in which the size needs to vary, is there a class that suits my needs so that I don't need to write something myself?
As a bit of background: The values for this array are coming out of a SQL ResultSet. I should only need a single int from each record (could change later though), but depending on the database queried, the array will differ in size.
I suppose I could do the query, run a loop to ResultSet.next() through it, incrementing a value (lets say 'i' for interest sake) as I go and then use ResultSet.first() to return to the first row of the ResultSet and then start recording in the array of size 'i'. However this seems silly and inefficient as it means I need to run through the ResultSet twice. Does anyone know of a class that could create an array with no fixed size?
EDIT: Apologies for the spelling in the title, it hurts my eyes too.
Last edited by porchrat; 07-22-2009 at 04:44 PM.
- 07-22-2009, 05:01 PM #2
- By bugger in forum JDBCReplies: 18Last Post: 06-25-2011, 08:36 PM
- By Yoruichi in forum AWT / SwingReplies: 5Last Post: 04-22-2009, 04:37 PM
- By valery in forum New To JavaReplies: 1Last Post: 08-06-2007, 08:27 PM
- By oregon in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 03:16 AM
- By Jamie in forum Advanced JavaReplies: 1Last Post: 05-20-2007, 08:52 PM