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.

Results 1 to 3 of 3

Thread: Hashmap

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Hashmap

    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.


  2. #2
    Member
    Join Date
    Jul 2013
    Posts
    219
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default Re: Hashmap

    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.

  3. The Following User Says Thank You to syedbhai For This Useful Post:

    GregBrannon (August 31st, 2013)

  4. #3
    Junior Member
    Join Date
    Aug 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Hashmap

    thanks

Similar Threads

  1. Hashmap
    By ryan12345 in forum Java Theory & Questions
    Replies: 6
    Last Post: November 2nd, 2012, 07:04 PM
  2. Cannot get values from hashmap
    By uhertz in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 17th, 2011, 07:44 PM
  3. [SOLVED] Should i use a hashmap?
    By 6Sloth9 in forum Collections and Generics
    Replies: 2
    Last Post: May 1st, 2011, 08:58 PM
  4. TreeMap vs HashMap
    By Kerr in forum Collections and Generics
    Replies: 7
    Last Post: March 10th, 2011, 10:12 AM
  5. Problem in HashMap
    By Hikari9 in forum Collections and Generics
    Replies: 2
    Last Post: April 19th, 2010, 10:44 PM

Tags for this Thread