Linked Questions

1 vote
0 answers
105 views

Possible Duplicate: Is there a Java reflection utility to do a deep comparison of two objects? I want to create a generic object comparison method like this - public static boolean ...
CodeBlue's user avatar
  • 15.6k
195 votes
24 answers
239k views

Say I have a class with no equals() method, to which do not have the source. I want to assert equality on two instances of that class. I can do multiple asserts: assertEquals(obj1.getFieldA(), obj2....
Ryan Nelson's user avatar
  • 4,696
14 votes
13 answers
21k views

This question is close, but still not what I want. I'd like to assert in a generic way that two bean objects are equivalent. In case they are not, I'd like a detailed error message explaining the ...
ripper234's user avatar
  • 231k
23 votes
7 answers
17k views

I've got a Java class, here's an example: public class Car { private int fuelType; private Date made; private String name; . . . // and so on Now let's say I have two car objects and I ...
Guy's user avatar
  • 6,522
23 votes
5 answers
33k views

I am trying to validate serialize and de-serialize routines by comparing the resulting object with the original object. The routines can serialize arbitrary and deeply nested classes and consequently ...
Howard May's user avatar
  • 6,665
16 votes
3 answers
13k views

There are two similar questions on SO: Is there a Java utility to do a deep comparison of two objects? Deep reflective compare equals but, it is funny, none of them gives a fully correct answer to the ...
Andremoniy's user avatar
  • 35.2k
3 votes
1 answer
6k views

Are there any utils in java which allow to check objects equality without equals overriding? For some reasons I don't want to provide my class with equals method. I need something like SomeUtils....
Normal's user avatar
  • 1,377
-1 votes
4 answers
4k views

To give a little background on what I am trying to do, please refer my previous question : Run a java method by passing class name and method name as parameter So basically I am trying to call a ...
Crickcoder's user avatar
  • 2,165
2 votes
3 answers
1k views

I need to compare two objects in Java, but they contain a lot of members, some not visible, and I don't have access to the source code - they're objects from a third-party package. I need to find out ...
Luchian Grigore's user avatar
2 votes
3 answers
1k views

Is there a way in which we can equate two objects? I know that we can use equals, but the problem is that I need to write a utility which can compare any two objects implementing same interface. ...
M.J.'s user avatar
  • 16.8k
0 votes
2 answers
1k views

I have a use case for filtering a set of objects based on multiple properties of the object. An approach that I would use in Javascript might be to create an object with only the properties that I ...
theMayer's user avatar
  • 16.3k
1 vote
1 answer
921 views

If you know EqualsBuilder from apache commons lang you know that you can use it for implementing equals methods with reflection. It seems to work well but since I am using third party software I need ...
EhmKah a.k.a. Michael Krauße's user avatar
0 votes
1 answer
258 views

Already referred few question here and there. Use Case - 1.) Given any Two objects, compare both of them property by property. 2.) It will contains Collections also, now compare collections of both ...
Ankur Singhal's user avatar
0 votes
1 answer
177 views

Object a1= "[{"rdf:resource":"record\/16777228-43386050"},{"rdf:resource":"record\/16777228-43386055"},{"rdf:resource":"record\/16777228-43386057"},{"rdf:resource":"record\/16777228-43386059"}]" ...
Amsaveni Natarajan's user avatar
0 votes
1 answer
52 views

I have a serializable class, that I'd like to compare. It contains many fields and will probably change many times in the future. What are the downsides of implementing equals like this: public class ...
Nils-o-mat's user avatar
  • 1,246

15 30 50 per page