Results 1 to 2 of 2
  1. #1
    jhetfield18 is offline Member
    Join Date
    Oct 2007
    Rep Power

    Default HashMap visual example

    Hi I'm obligated to use the hashmap class to implement a backgammon game and I have the following given code:
    public Map<PointType,List<Color>> getPoints();
    It's given in Map but we're supposed to use a HashMap:P
    Can anyone explain or describe how a Map or a Hashmap is virtually.
    a hashtable can be described as non-sequent places in memory that contain certain data allocated with the help of a hash function.I simply can't get it as a picture in my head at least after reading the API.

  2. #2
    staykovmarin is offline Senior Member
    Join Date
    Nov 2007
    Newport, WA
    Rep Power


    Well imagine an array with methods, without fixed size however, it expands as you add elements to it.

    With a HashMap you can add as many items as you want, and each item has its own key. So you add them in pairs, using the put() method. Then when you invoke the get method, you add a key as an argument, and it will return whatever value is associated with that key.

    This post really doesnt belong here, in my humble opinion.
    Last edited by staykovmarin; 12-12-2007 at 07:47 PM.

Similar Threads

  1. Hashmap
    By dirtycash in forum New To Java
    Replies: 5
    Last Post: 12-03-2007, 02:58 AM
  2. DB Visual ARCHITECT 4.1 sp1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-16-2007, 06:50 PM
  3. DB Visual ARCHITECT 4.1
    By levent in forum Java Software
    Replies: 0
    Last Post: 08-04-2007, 07:48 PM
  4. what is hashmap
    By gabriel in forum New To Java
    Replies: 5
    Last Post: 08-03-2007, 01:23 PM
  5. Help with HashMap in java
    By toby in forum New To Java
    Replies: 1
    Last Post: 07-25-2007, 08:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts