ArrayList comparsion
-
Hi all, I have 3 ArrayList, each of them stored some string color name, I want to ask how can I check any duplicated strings between them? Ofcourse, I can load all strings from one arrayList, and then use ArrayList.Contains(string) to check. however, any fast way to check this ?? Can I only use ArrayList.Contains() to compare with other ArrayList directly? Thanks for help~~
-
Hi all, I have 3 ArrayList, each of them stored some string color name, I want to ask how can I check any duplicated strings between them? Ofcourse, I can load all strings from one arrayList, and then use ArrayList.Contains(string) to check. however, any fast way to check this ?? Can I only use ArrayList.Contains() to compare with other ArrayList directly? Thanks for help~~
hi, ArrayList impliments few interfaces like IList,ICollection,IEnumerable,ICloneable by default. Suppose if you want to compare the element of arraylist you need to impliment IComparer interface. This contain one abstract method called Compare. ************************** S r e e j i t h N a i r **************************
-
Hi all, I have 3 ArrayList, each of them stored some string color name, I want to ask how can I check any duplicated strings between them? Ofcourse, I can load all strings from one arrayList, and then use ArrayList.Contains(string) to check. however, any fast way to check this ?? Can I only use ArrayList.Contains() to compare with other ArrayList directly? Thanks for help~~
azusakt wrote: however, any fast way to check this ?? If you want fast lookups and have unique elements, I suggest you use a Hashtable instead :) top secret xacc-ide 0.0.1
-
Hi all, I have 3 ArrayList, each of them stored some string color name, I want to ask how can I check any duplicated strings between them? Ofcourse, I can load all strings from one arrayList, and then use ArrayList.Contains(string) to check. however, any fast way to check this ?? Can I only use ArrayList.Contains() to compare with other ArrayList directly? Thanks for help~~
azusakt wrote: I have 3 ArrayList, each of them stored some string color name, I want to ask how can I check any duplicated strings between them? first off - why do you have 3 arraylist which seem to be related to eachother - wont 1 suffice? azusakt wrote: Ofcourse, I can load all strings from one arrayList, and then use ArrayList.Contains(string) to check. however, any fast way to check this ?? Can I only use ArrayList.Contains() to compare with other ArrayList directly? you might consider changing your datastructure to something that provides constant time mechanisms.. an arraylist is basic - some of the operations performed on it - (i think :D ) are not necessarily constant time complexity. how about something that using a hashing function of some sort ? like for example if you were to have 3 hashtables you could simply do a containskey which is constant time on thme ... you might want rethink what you are doing though - can you suffice with just 1 and then pass a reference to the remain parts of your program that require this datastructure? Danny!