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.
ques from JQplus Sample exam: Your application needs to load a set of key value pairs from a database table which never changes. Multiple threads need to access this information but none of them changes it. Which class would you use to store such data? The options are Hashtable,HashMap,TreeMap,Set,List and 2 choices I think the option should be HashMap and HashTable but can we just use HashMap as we do not need to synchronize this so we don't need HashTable.
What are you asking? I thought the question stated that you should choose two answers. If that's the case, then HashMap and Hashtable are the correct answers. The only reason HashMap is a correct answer is because there is no need for synchronization. Corey
Originally posted by Jose Botella: HashMap is quicker than HashTable.
To elaborate...HashMap is quicker than Hashtable becauseHashMap isn't synchronized. There is no need for invoking threads to take the extra time to acquire a monitor or to wait for one in the case that it has already been acquired by another thread. Corey