This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hashtable does contain a functional implementation of equals(), so that's easy. To get the common elements, you can get the set of Map.Entry objects from both maps, and use Collection.retainAll() along the following lines: HTH
Peter den Haan
Joined: Apr 20, 2000
Oh, and in practice the only limit is your memory.
Joined: Jan 12, 2004
But your code Set common = new HashSet(map1.entrySet()); common.retainAll(map2.entrySet());
This will return me only the keys i want the key- value pairs. and it has to be done in the most efficient ways, already my application is heavily loaded. Please let me know. i am not sticking to hashtable or Hashmap. But the goal has to be achieved in the most efficient way, in the minimum time. as tomorrow the hashtable or hashmap may contains hundreds of entires.
Waiting for reply Thanks With Regards, Manish B [ June 02, 2004: Message edited by: manish basotia ]