?
Solved

How can I tell if two arraylists are the same?

Posted on 2013-12-13
1
Medium Priority
?
256 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses

839 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