Solved

Compare objects of different classes in java .

Posted on 2013-11-21
1
159 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now