Create an Unknown Number of ArrayLists

G

Guest

I would like to create an unknown number of Arraylists, meaning, I don't know
how many I should create until runtime.

I will be reading a table, and 0,1,2, or more fields have to be put into
individual ArrayLists.

How do I create an unknown number of ArrayLists?

Right now I put all the values into one ArrayList. I know how many fields
are in the ArrayList so I then know that every one, or every other one, or
every third one goes together. I would like three separate lists, OR, a way
to enumerate the fields as I put them in the one ArrayList.

I do know how many fields I have at runtime.
 
G

Guest

I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.
 
M

Miro

i have done something similar,

but what I did was create a class with properties,
and make that class into an array.

As I need to create more elements, I use a Redim with a preserve on it.
I know it says this takes more time and such, but ill take the extra 2
seconds of processing time :)
-it made my life easier down the road.

M.
 
J

Jon Shemitz

Andy said:
I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.

I did mean an ArrayList of ArrayList-s or (better) a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top