Results 1 to 5 of 5
  1. #1
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

    Default Hashtable(int initialCapacity, float loadFactor)

    I am confused aboout the following Hashtable constructor:
    Java Code:
    Hashtable(int initialCapacity, float loadFactor)
    What is loadFactor? Is it the factor by which Hashtable grows?? If yes - why is it in float?

  2. #2
    m_srikanth is offline Member
    Join Date
    Nov 2007
    Posts
    8
    Rep Power
    0

    Default

    The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased.

    check the API for further information :
    JAVA API for HashTable

  3. #3
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

    Default

    Just checked the API. It says:
    - loadFactor - the load factor of the hashtable.

    If I specify 1.5, what exactly it means in terms of Hashtable.

  4. #4
    m_srikanth is offline Member
    Join Date
    Nov 2007
    Posts
    8
    Rep Power
    0

    Default

    The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. When the number of entries in the hashtable exceeds the product of the load factor and the current capacity, the capacity is increased by calling the rehash method.

    Generally, the default load factor (.75) offers a good tradeoff between time and space costs. Higher values decrease the space overhead but increase the time cost to look up an entry (which is reflected in most Hashtable operations, including get and put).
    Last edited by m_srikanth; 11-23-2007 at 01:35 AM.

  5. #5
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

Similar Threads

  1. Hashtable example
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-15-2008, 09:43 AM
  2. String to Float
    By durahman in forum New To Java
    Replies: 2
    Last Post: 02-12-2008, 01:17 AM
  3. Float to String
    By mew in forum New To Java
    Replies: 4
    Last Post: 12-29-2007, 06:08 PM
  4. convert string to float
    By miss_dot in forum NetBeans
    Replies: 1
    Last Post: 11-15-2007, 12:26 AM
  5. Class float
    By Peter in forum New To Java
    Replies: 1
    Last Post: 07-08-2007, 02:17 AM

Posting Permissions

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