Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: What is hashCode?

  1. #1

  2. #2
    Registered
    Join Date
    Mar 2016
    Posts
    76
    Hash Code is used for bucketing in hash implementation like hashmap, hashtable, hashset...

  3. #3
    Registered pxljobs's Avatar
    Join Date
    Jul 2016
    Location
    Bangalore
    Posts
    290
    Hash code is a code that identifies each object,not necessarily unique hash code is generally used for comparing objects, if two object of same type can have same hash code they said to be equal hash code is integer value this would be automatically generated by JVM.

  4. #4
    Registered
    Join Date
    Feb 2017
    Posts
    10
    Hi, HashCode is a mathematical formula that returns some integer value. This integer value is used as index in array.

    Thanks!

    _____
    secdevops

  5. #5
    Registered
    Join Date
    Jan 2017
    Posts
    55
    A hashcode is a number generated from any object. This is what allows objects to be stored/retrieved quickly in a Hashtable. Imagine the following simple example: On the table in front of you you have nine boxes, each marked with a number 1 to 9.

    Thank you~

    HAPPY TO HELP YOU!

  6. #6
    Junior Registered
    Join Date
    Feb 2017
    Posts
    4
    HashCode is a mathematical formula(there is no best hash function) that returns some integer value.
    This integer value is used as index in array.
    Example
    hashCode(int value){

    /*Some hash function computation goes here*/
    return hash;
    }

    The hash is returned and now it acts as the index of the array. The value is inserted in that place. Now if you want to retrieve that value then you again use hashCode(val) and get the hash of value and directly take that value from index of array.

    Well what happens if hashCode(val) returns index where the value is already inserted. This is called collision and some collision handling strategy is used(example separate chaining).

    Qualities of good hash function
    For same value the Hash function should return same hash
    hash function should distributed the hash evenly across the array.

  7. #7
    Registered
    Join Date
    Nov 2016
    Posts
    649
    A hashcode is a number created from any question. This is the thing that enables articles to be put away/recovered rapidly in a Hashtable. Envision the accompanying basic case: On the table before you have nine boxes, each set apart with a number 1 to 9.

  8. #8
    Registered
    Join Date
    Nov 2017
    Posts
    12
    Hash code is used for bucketing in hash execution like hashmap, hashtable, hashset.

  9. #9
    Registered
    Join Date
    Jan 2018
    Posts
    66
    A hashcode is a number generated from any object. This is what allows objects to be stored/retrieved quickly in a Hashtable. Imagine the following simple example: On the table in front of you you have nine boxes, each marked with a number 1 to 9.

  10. #10
    Registered
    Join Date
    Oct 2016
    Posts
    270
    A hashcode() is a function that takes an object and outputs a numeric value. The hashcode for an object is always the same if the object doesn't change.
    Best Android Training | Devops Training | SQL Server Training and many more IT courses.

  11. #11
    Registered RH-Calvin's Avatar
    Join Date
    Mar 2017
    Location
    Forum
    Posts
    1,667
    A hash code is a numeric value that is used to insert and identify an object in a hash-based collection such as the Dictionary<TKey, TValue> class, the Hashtable class, or a type derived from the DictionaryBase class.
    Cheap VPS Hosting | VPS Starting from $12 PER Year
    Cheap Dedicated Server | Unmetered Bandwidth | Free Setup and IPMI

  12. #12
    Quote Originally Posted by RH-Calvin View Post
    A hash code is a numeric value that is used to insert and identify an object in a hash-based collection such as the Dictionary<TKey, TValue> class, the Hashtable class, or a type derived from the DictionaryBase class.
    Exactly correct information. A hashcode is a numeral generated from whichever object. This is what permits objects to be saved / repossess promptly in a Hashtable.

  13. #13
    Quote Originally Posted by RH-Calvin View Post
    A hash code is a numeric value that is used to insert and identify an object in a hash-based collection such as the Dictionary<TKey, TValue> class, the Hashtable class, or a type derived from the DictionaryBase class.
    Exactly correct information. A hashcode is a numeral generated from whichever object. This is what permits objects to be saved / repossess promptly in a Hashtable.

  14. #14
    eFusionWorld
    Join Date
    Jul 2018
    Location
    Pompton Plains, NJ 07444, USA
    Posts
    76
    A hash code is a numeric value that is used to identify an object during equality testing. To address the issue of integrity, it is common to make use of hash codes. The goal is for every object to return a distinct hash code, but this often cannot be absolutely guaranteed. That is, the default implementation of the GetHashCode() method does not guarantee unique return values for different objects.

  15. #15
    Registered
    Join Date
    Jul 2019
    Posts
    20
    Hash code in the .NET framework is a numeric value that helps in the identification of an object during equality testing and also can serve as an index for the object. The value contained in the hash code is not permanent in nature. The purpose of hash code is to help in efficient lookup and insertion in data collections which are based on a hash table.

Tags for this Thread

Bookmarks

Posting Permissions

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