dear all
I want to know real time live example of hashmap and where to use in java web application.
pls provide real time example.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
dear all
I want to know real time live example of hashmap and where to use in java web application.
pls provide real time example.
Hello.
Suppose a university wants to display student's grade based on student's id. And of course student id is unique.
For this they can develop one web application in java. The student will enter the id in the browser and the request goes to servlet. The servlet may not want to read grade from database everytime. Because db operations are expensive. So what servlet will do is it will read all the student details (id & grade) at the time of startup and cache then into a HashMap object. In this case, key will be id and value will be grade.
So when the request comes from the browser the servlet will get the grade(i.e. value) based on the id(i.e. key) from the HashMap object.
I suggested one real time example where Hashmaps can be used. You can think of similar examples.
Syed.
GregBrannon (August 31st, 2013)
thanks