FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS
CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO
LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE
NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?



FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE ..

Answer / fraz

Lets say you have Employee class

public class Employee{
private String id;
private String name;
..getter/setters..

}

You just have to overide hascode() and equals() method in
above class.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Core Java Interview Questions

Why we can not force Garbage Collection?

7 Answers  


Is there memory leaks in java?

3 Answers  


What class of exceptions are generated by the java run-time system?

0 Answers  


What is the intersection and union methods?

0 Answers  


What is the difference between getCodeBase and getDocumentBase methods?

1 Answers   CS Business Services,


Why can't you declare a class as protected?

0 Answers  


What are the rules for variable declaration?

0 Answers  


what is overloading in java?

13 Answers   Ascent, DNS, Infosys, SDA, VelTech,


how to handle http request in struts

2 Answers   Polaris,


what is java bean?where can we use it?

12 Answers   TCS,


How many wrapper classes are there in java?

0 Answers  


What are keywords and reserved words in java?

0 Answers  


Categories