I have a question regarding object comparison. I have to different kind of objects where one is serialized and other is not. And i want to see if they are same or not. How can i do that?
Most likely there content are same because they have same fields. I can't override equals in any of the classes as they are already provided and not allowed to change them. So i was wondering if anyone have any idea how to compare them.
Jeena Jeen wrote:yaah i i can't compare with equals. but what kind of method do i need to create? should i make a method that compare each ield. but that will be too expensive. can i use MD5 or something like that for this compare. I m not intersted in what is different. i just want to know if they are exactly same or not?
You really think that comparing three fields - two of them primitives - will be slower than calculating an MD5 algorithm? Just write a simple comparison method.