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?
Answer Posted / 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 View All Answers
Explain about interrupt() method of thread class ?
4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (
What are the restrictions that are applied to the java static methods?
What data type is true or false?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
What is the implementation of destroy method in java. Is it native or java code?
What is the difference between a field variable and a local variable?
Is vector ordered in java?
Can we overload run() method in java?
How does queue work in java?
Can we compare two strings in java?
How to write custom exception in java?
What is return code?
Can you give few examples of final classes defined in java api?
What is the purpose of the finally clause of a try-catch-finally statement in java programming?