Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4057052
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:54:16+00:00 2026-05-20T14:54:16+00:00

Some hash table schemes, such as cuckoo hashing or dynamic perfect hashing , rely

  • 0

Some hash table schemes, such as cuckoo hashing or dynamic perfect hashing, rely on the existence of universal hash functions and the ability to take a collection of data exhibiting collisions and resolve those collisions by picking a new hash function from the family of universal hash functions.

A while ago I was trying to implement a hash table in Java backed by cuckoo hashing and ran into trouble because while all Java objects have a hashCode function, the value that hashCode returns is fixed for each object (unless, of course, the objects change). This means that without the user providing an external family of universal hash functions, it’s impossible to build a hash table that relies on universal hashing.

Inititially I thought that I could get around this by applying a universal hash function to the object’s hashCodes directly, but this doesn’t work because if two objects have the same hashCode, then any deterministic function you apply to those hash codes, even a randomly-chosen hash function, will result in the same value and thus cause a collision.

It seems like this would be detrimental to Java’s design. It means that HashMap and other hash containers are completely prohibited from using tables based on universal hashing, even if the language designers may think that such tables would be appropriate in the language design. It also makes it harder for third-party library designers to build hash tables of this sort as well.

My question is: is there a reason that Java opted to design hashCode without considering the possibility of hashing objects with multiple hash functions? I understand that many good hashing schemes like chained hashing or quadratic probing don’t require it, but it seems as though the decision makes it hard to use certain classes of algorithms on Java objects.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:54:17+00:00Added an answer on May 20, 2026 at 2:54 pm

    Simplicity. Java allows class designers to provide their own hashCode, which as you mention is good enough for “ordinary” hash tables, and can be hard enough to understand.

    Besides, when the Java Collections API was designed, having generic hash tables in the standard library was bold enough a move already. C has never had them. C++ had them in the STL as hash_set and hash_map, but those didn’t make it into the standard. Only now, in C++0x, are hash tables being considered for standardization again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a hash table (source code by Google Inc) to store some method
I'm trying to include a simple hash table class in some files with a
Can some one explain Given a hash table array of size N=11., and using
I am trying to decide if I should use a hash table of some
I have some hash table that is losing its values at some point in
For some reason when I insert elements into my hash table all elements at
Suppose we have a hash table that maps strings to functions. In my example
Greetings, I have some mysql tables that are currently using an md5 hash as
For managing some cache, I need a sort of Hashtable with the ability to
I want to write a program to hash some data and preferably i would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.