Results 1 to 2 of 2
Thread: HashMap visual example
- 12-12-2007, 06:02 PM #1
Member
- Join Date
- Oct 2007
- Posts
- 9
- Rep Power
- 0
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.
e.g.
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.
- 12-12-2007, 07:45 PM #2
Senior Member
- Join Date
- Nov 2007
- Location
- Newport, WA
- Posts
- 141
- Rep Power
- 0
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
-
Hashmap
By dirtycash in forum New To JavaReplies: 5Last Post: 12-03-2007, 02:58 AM -
DB Visual ARCHITECT 4.1 sp1
By JavaBean in forum Java SoftwareReplies: 0Last Post: 10-16-2007, 06:50 PM -
DB Visual ARCHITECT 4.1
By levent in forum Java SoftwareReplies: 0Last Post: 08-04-2007, 07:48 PM -
what is hashmap
By gabriel in forum New To JavaReplies: 5Last Post: 08-03-2007, 01:23 PM -
Help with HashMap in java
By toby in forum New To JavaReplies: 1Last Post: 07-25-2007, 08:04 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks