how to have a list where an index has three values associated with it.

woodman5k

New member
Joined
Nov 16, 2011
Messages
2
Programming Experience
Beginner
Hi,

I have been searching everywhere but I am unable to find a reference to what I need. I have a huge number of entries where each entry is composed of three long numbers:

a b c
1 2 40
2 1 40
1 8 12
3 9 13
8 1 12
ect.

in my algorithm I will find that I need to disregard values in column a which will then lead me to disregard values in column b.

I initially thought that I may want to use three arrays and just change the disregarded value to a null value with each iteration. But I am hoping to find function that would allow me to not have to loop through the entire array every time. This lead me to want to define the columns as lists where I could remove specific values from the list and reduce the size of the list with each iteration of the algorithm. The problem then is how do I say, listb.remove(8) and at the same time have the corresponding values for lista(1) and listc(12) removed? Any thoughts or ideas?

Thanks!
 
Thanks for the reply. I know how to work with collections and arrays, I am not sure what you mean by defining a type. Do you mean define as a structure or a class. If so, or even if not, could you give me a quick and dirty example to help me along? I tried defining a structure before but couldn't figure out how to define the structure as a list.
 
Yes I do mean define a structure or class. You don't define the type as a list. You define the type first, then you create an array or collection of instances of that type. You've worked with Strings before, right? You can create a String array or a List(Of String) but that doesn;t mean that the String class is defined as a list. You can put eggs in an egg carton but that doesn't mean that an egg somehow incorporates carton properties.
 
Is there any relationship between columns A B and C or are they simply 3 separate lists with no common index?

If they have a common index how ELSE would you shorten the list? If the index is common to all three lists, then all three lists must have the same number of elements. In which case you could simply define a class as suggested.

If they are truly independant, then just use three different arrays/lists?
 
Back
Top