468,104 Members | 1,293 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,104 developers. It's quick & easy.

comparing values in ARRAYLISTS

I need to compare the value of a field in a row on an arraylist with the value of a field on a second arraylist
I have this bit of code working for arrays but cant get it working for arraylists
The secone argument here (1) represents the second field in the row, with arraylists I get a message saying to many arguments.

Can I do this with arraylists or do I need to copy the arraylists to arrays?

Thanks
For q As Integer = 0 To 9

For j As Integer = 0 To 9

If StrArray1(q, 1) = StrArray2(j, 1) Then

count = count + 1
End If

Next
Next
From http://www.developmentnow.com/g/38_0...nguages-vb.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Aug 2 '06 #1
3 2817
hi steve, in theory you could do an arraylist of arraylists.

but... I would think twice before implementing something
like that, with quadratic complexity.

Probably there are more efficient way to organize
your class and data structures in order to avoid that.

-tom

steve ha scritto:
I need to compare the value of a field in a row on an arraylist with the value of a field on a second arraylist
I have this bit of code working for arrays but cant get it working for arraylists
The secone argument here (1) represents the second field in the row, with arraylists I get a message saying to many arguments.

Can I do this with arraylists or do I need to copy the arraylists to arrays?

Thanks
For q As Integer = 0 To 9

For j As Integer = 0 To 9

If StrArray1(q, 1) = StrArray2(j, 1) Then

count = count + 1
End If

Next
Next
From http://www.developmentnow.com/g/38_0...nguages-vb.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Aug 2 '06 #2
grazie, ma come?

From http://www.developmentnow.com/groups...hreadid=797408

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Aug 2 '06 #3
ah sei italiano :)

if you describe you original problem, perhaps I or other people here
can
be of help to reorganize your code. Keep in mind that multidimensional
arrays are quite inefficient in .NET and they can be usually replaced
with more efficient
objects based on unidimensional collections.

tommaso

stefano ha scritto:
grazie, ma come?

From http://www.developmentnow.com/groups...hreadid=797408

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Aug 2 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jorgen Gustafsson | last post: by
1 post views Thread by DOTNETGUY | last post: by
2 posts views Thread by darrel | last post: by
11 posts views Thread by John Salerno | last post: by
reply views Thread by John Wright | last post: by
5 posts views Thread by SneakyElf | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.