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

How do you sort arrays in java?

0 Answers  


Can a method be static?

0 Answers  


How do you escape sequences in java?

0 Answers  


Can a final variable be null?

0 Answers  


suppose string s1="rajnish"; string s2="bhaskar"; then what will be happend ?

9 Answers   Fidelity,






Explain parallel processing in java8?

0 Answers  


Why java is made?

0 Answers  


I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

0 Answers  


how can you take care of mutual exclusion using java threads? : Java thread

0 Answers  


How the elements are organized in BorderLayout?

5 Answers  


Does treeset use compareto?

0 Answers  


Can we add two byte variables and assign the result to a byte variable ? b=b1+b2 where b,b1,b2 are byte types

4 Answers   TCS,


Categories