Solved

Compare objects of different classes in java .

Posted on 2013-11-21
1
160 Views
Last Modified: 2014-01-21
I have 2 value objects or datamodel objects . They have close to 15 getters and setter methods . everytime i will have to compare these two objects by manually using if equals etc .
Is there something I can use to compare a few methods in 2 different objects ?
0
Comment
Question by:FranklinRaj22
1 Comment
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 39667713
Have a look at the Commons Lang api. There's a default equals implementer in there that uses reflection
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
github account with ecipse 1 50
split string containing \r\n in Java 46 45
login jsp example 24 51
SHA2 certs for IIS AND Java? 2 98
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

825 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