Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions Java hashmap, hashtable
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


samar
Java hashmap, hashtable
1 Answer(s)      4 years and 3 months ago
Posted in : Java Interview Questions


When are you using hashmap and hashtable?

Advertisement
View Answers

October 26, 2010 at 11:01 AM


Hi,

Here is the answer.

  • The hashMap and Hashtable are differ from each other according to following points-
  • HashMap allows null values for key and value whereas Hashtable doesnt allow.
  • HashMap does not guarantee that the order of the map will remain constant over time.
  • HashMap is non synchronized where as Hashtable is synchronized.
  • HashTable is an Old java class but Hashmap is a new java class in java 2.
  • In HashTable you can change the iteration but in the case of HashMap you can change the iteration but you will get a java.util.ConcurrentModificationException.

Thanks.



Related Tutorials/Questions & Answers:
Java hashmap, hashtable
Java hashmap, hashtable  When are you using hashmap and hashtable
Differences between HashMap and Hashtable?
Differences between HashMap and Hashtable?  Differences between HashMap and Hashtable
Advertisements
Java hashtable
Java hashtable   What is hash-collision in Hashtable and how it is handled in Java
hashtable java swing
hashtable java swing  i m getting this warning code is here Hashtable nu=new Hashtable(); Hashtable ns=new Hashtable(); nu.put(new... mber of the raw type Hashtable plz help me
Java collection -Hashtable
Java collection -Hashtable   What is Hashtable in java collection?   Java collection -Hashtable;- The hashtable is used to store value... { public static void main(String [] args){ Map map = new Hashtable
How to find hashtable size in Java?
How to find hashtable size in Java?  Hi, What is the code for Hashtable in Java? How to find hashtable size in Java? Give me the easy code. Thanks
HashMap in Java
is almost equal to HashTable, the only difference is that HashMap allows null... of Hashmap in Java: package net.roseindia.java; import java.util.HashMap...HashMap class is used to implement Map interface. The value of HashMap
hashtable - Java Beginners
hashtable  pls what is a hashtable in java and how can we use... to Roseindia"); Hashtable hash = new Hashtable(); hash.put("amar","amar"); hash.put...://www.roseindia.net/java/ Thanks. Amardeep
Example of HashMap class in java
Example of HashMap class in java. The HashMap is a class in java collection framwork. It stores values in the form of key/value pair. It is not synchronized
Doubts regarding Hashtable - Java Beginners
it possible to create a hashtable like this? java.util.Hashtable hashtable=new...(12,13,10,1)); since we get the key of hashtable from the database. When I tried... information, http://www.roseindia.net/java/example/java/util/ Thanks
Hashtable java prog - Java Interview Questions
Hashtable java prog  Create a hashtable with some student hall ticket numbers and their results. when we type a hallticket number,it shud display the results? please provide the detail java code for this? thanks in advance
Java HashMap example.
Java HashMap example. The HashMap is a class in java. It stores values in name..., you will see how to create an object of HashMap class. How to display vlaue of map. Code:  HashMapExample .java package net.roseindia.java
HASHMAP
HASHMAP  HI CAN WE ADD PRIMITIVE DATA TYPE IN HASHMAP IN JAVA 1.5 VERSION . THANKS KALINS NAIK   Java HashMap Example
Java Hashmap Sorting - Java Beginners
Java Hashmap Sorting   I have a sorting issue with a Hashmap. My constraint is that I MUST use the Hashmap and work with existing code. I do a database query and place the results in a Hashmap. When I iterate thru the Hashmap
Hashmap
*; public class HashTable { public static void main(String args[]){ HashMap hm...Hashmap  public class HashTable { public static void main(String args[]){ HashMap hm=new HashMap(); hm.put(new Integer(2), "Two"); hm.put
Hashtable java prog - Java Interview Questions
Hashtable java prog  Create a Hashtable with some students hall... the results? please provide the java code detaily for this query?thanks... bal; Hashtable table = new Hashtable(); table.put( new Integer(1111),"Selected
HashMap/HashSet - Java Beginners
HashMap/HashSet  im working on a game, and i want to know how does the code for HashMap and HashSet work or can you give me the code that needs to be included in the game engine. I have the exam on monday. Can you please help
Java HashMap - Java Tutorials
) { Map m1 = new HashMap(); m1.put("Ankit", "8"); m1.put("Kapil", "31... : C:\Program Files\Java\jdk1.6.0_18\bin>java MapDemo
HashMap
HashMap  How to work hashmap and hashset internally
Java HashMap iterator and example
Java HashMap Iterator is an interface. It keeps the data in the key and value form. It is implemented by HashMap. hashMap doesnot have iterator method... elements can be traversed by the Iterator. Example of Java HashMap
Java hashmap clear() method example.
Java hashmap clear() method example. This tutorial is based on clear() method of java HashMap class. It removes all values from HashMap. Code: ... into HashMap */ obMap.put(new Integer(1), "AAAA"); obMap.put(new
hashmap
hashmap  write a program that shows the use of Hashmap class
Java Collection : Hashtable
Java Collection : Hashtable In this tutorial, we are going to discuss one of concept (Hashtable ) of Collection framework. Hashtable  : Hashtable.... When you increase the entries in the Hashtable, the product of the load
Hashmap
Hashmap  Hi i want to date and day in hashmap , 1 want to display according to day with date, how to write aprograme
Java Hashtable Iterator
be traversed by the Iterator. Java Hashtable Iterator Example import java.util.*; public class hashtable { public static void main(String[] args) { Hashtable hastab = new Hashtable(); hastab.put("a", "andrews
HashMap
HashMap  How can you get a HashMap to Display Text onto a Text Field that is defined and Set up to JPanel on a different Class static class public static Map <String, ActionListener> listener = new HashMap <String
How to get Keys and Values from HashMap in Java?
How to get Keys and Values from HashMap in Java? Example program of iterating through HashMap In this tutorial I will explain you how you can iterate... and values from HashMap? This is the most asked questions in the Java
Java Hashmap Iterator
Java HashMap Iterator is a collection class. It implements the Map interface. It keeps the data in the key and value form. Java HashMap has no iterator.... Set's all elements can be traversed by the Iterator. Java Hashmap Iterator
The Hashtable Class
The Hashtable Class In this section, you will learn about Hashtable and its implementation with the help of example. Hashtable is integrated with the collection framework and also implements the Map interface. Similar to HashMap
Any Link Between ArrayList and HashMap - Java Interview Questions
interview questions which relates ArrayList and Hashmap. I mean how to link ArrayList and HashMap. Thanks Prakash  Hi Friend, Similarities: 1)ArrayList and HashMap both have a capacity. 2)Both are not synchronized. 3)Both
how to check particular value is avilable in hashmap - Java Beginners
how to check particular value is avilable in hashmap  Hi friends, i created a hashmap,in that hashmap key is tagginglist and value is tagsname... is available in the hashmap or not. my code is like this: Hashmap msgMap=new HashMap
Advertisements
 

 

 

DMCA.com