Solved

How can I tell if two arraylists are the same?

Posted on 2013-12-13
1
250 Views
Last Modified: 2013-12-13
How can I tell if two arraylists are the same?  I have two arraylists that I believe are identical but arraylist1.equals(arraylist2) always returns false.  They both have the same number of items with the same content and types in the same order.  How can I tell what if anything is different? or is there some other way to compare arraylists.
0
Comment
Question by:NevSoFly
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39718278
but arraylist1.equals(arraylist2) always returns false
That's because Equals compares references, not data. If you want to determine if the two ALs are equal, then you will have to loop over each AL, comparing each item in one to every item in the other.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb.net checkbox 7 47
how to wrap a merged cells of datagridview column in vs2010 (vb.net) 8 34
Crystal reports vb.net 2 41
Complex SQL statement in VB.NET 7 16
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question