Solved

How can I tell if two arraylists are the same?

Posted on 2013-12-13
1
251 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 - Windows UserName index and length error 4 34
Regex validation 2 28
Modal Popup Extender control 1 38
get combo value in class 5 14
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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