Tuesday, October 1, 2002 12:19 PM
I have a need to create a Vector whose name should be generated dynamically, as I don't know when I access the database exactly how many Vector's I'll need. In other words, say I run a database query that returns "Bob" "Jane" and "Sue". Now I want to loop through that resultset, and create a vector for each one. Optimally, I would like to call them something like dataBob dataJane and dataSue. The next time through may return other results. Does anyone know how I would create unique vector names based on the results returned by my database query?
Re: creating dynamic variables
Wednesday, October 2, 2002 07:28 AM
But there tends to not be any good reason to want to dynamically create variables on the stack anyway. The other posters are right, what you are really looking for is a data structure to hold some vectors which you can retrieve by name--which is precisely what HashMap is for.
Tuesday, October 1, 2002 12:52 PM