Results 1 to 4 of 4
  1. #1
    hddbogdan is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default isWellFormed() for HashMap

    Hello, I`m doing a project where I have to store the accounts of a bank in a hash table structure. I have managed to do that by using a HashMap object and storing the accounts using the pin numbers as keys.

    The project demands that I use design by contract and I need to create a isWellFormed() method for the hash map in order to check the hash function it uses, whether the linked list is created properly... and I don't know how I could access the elements of the HashMap. Any ideas?

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    6

    Default

    Quote Originally Posted by hddbogdan View Post
    ... I don't know how I could access the elements of the HashMap. Any ideas?
    The HashMap API docs tell you all the access methods available.

  3. #3
    hddbogdan is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    I have read the API docs and have worked with the HashMap. The rest of the project is done, I just need to make a method which checks if the HashMap is correctly built. I know its kinda weird since it is a java class, but that`s what the project requires.

    I need access to the hash function and to the linked list it creates in case of collision...

  4. #4
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default

    I'm just guessing here as you don't provide much information on the requirements, but it sounds like the project requires you to write your own HashMap/HashTable - these values (hash function and buckets) are encapsulated within the HashMap class (eg, they aren't visible and you can't access these directly), and I can guarantee they are correctly built
    Last edited by doWhile; 04-22-2011 at 03:03 PM.

Similar Threads

  1. Hashmap to TXT and TXT to Hashmap
    By elvinny in forum Advanced Java
    Replies: 4
    Last Post: 02-16-2011, 11:12 PM
  2. Replies: 7
    Last Post: 12-08-2009, 07:17 PM
  3. HashMap
    By koolhoney in forum Advanced Java
    Replies: 1
    Last Post: 03-30-2009, 08:08 PM
  4. Hashmap - get key according to value
    By gtriant in forum New To Java
    Replies: 1
    Last Post: 12-15-2008, 02:29 PM

Tags for this Thread

Posting Permissions

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