This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 ]